You can use the following code to verify and debug which pattern in the .gitignore file is causing a particular file to be ignored:
# git 1.8.2+ git check-ignore -v path/to/file
Note that it is possible to pass multiple file names to git check-ignore.