I have had exactly the same problem--even if I prepare a .gitignore file before the first time I add anything.
And I found the problem was in the blank space in my ignore file.
DO NOT add any white space in your ignore file and try again. I think everything will just work fine.
Good luck