I'm on windows and my
#this is a comment
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
nothing added to commit but untracked files present (use "git add" to track)
Fixed. Ok, I created the .gitignore file in notepad on windows and it wasn't working. When I viewed the .gitignore file in linux it looked like organised gibberish - perhaps notepad had written out unicode rather than ascii or whatever 8-bit is.
So I rewrote the file on my linux box, and when I pulled it back into windows it works fine! Hurrah!