18 November 2013

Git ignore won't ignore my files

Today I wasted a good half hour scratching my head over why Git wouldn't ignore my files. I put  my .gitignore file in my .gitignore:

.gitignore 

But .gitignore was still showing up in git status. At first I tried adding some stars and generally just fooling around, but that didn't work. After thinking and reading some documentation I still couldn't find anything wrong with it.
Finally I stumbled over the problem. There was an extra space at the end of the line. I removed that and all was well again.
Remember: Remove whitespace!