user3280133 user3280133 - 1 year ago 120
Git Question

Gitignore not working


file isn't working for some reason, and no amount of Googling has been able to fix it. Here is what I have:


It's in the directory
, which is my git repo. I'm running Git because I'm on a MacBook running OSX 10.8.6.

Answer Source

The files/folder in your version control will not just delete themselves just because you added them to the .gitignore now. They are already in the repository. You have to remove them. You can just do this with this:

git rm -rf --cached .
git add .

This removes all files from the repository and adds them back (this time respecting the rules in your .gitignore).

Remember to commit everything you changed before you do this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download