If you have already added a file to be tracked but now want it not to be you will need to add it to a .gitignore file in the root of your git repository then remove them from being tracked:
git rm --cached <file>
If you need to remove a whole folder and don’t want to list all the individual files you can use:
git rm -r --cached .
Then re add all files:
git add .
and commit your changes:
git commit -m "Added /folder to .gitignore"