The reason it isn't working is (probably) because you added some of those files before you added the .gitignore
- so you have to remove them from git before they're able to be ignored.
Source: https://stackoverflow.com/a/1139797/2128691
First, commit any outstanding code changes, and then, run this command:
git rm -r --cached .
This removes everything from the index, then just run:
git add .
Commit it:
git commit -m ".gitignore is now working"