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!