When a file is ignored by git you can use the check-ignore command which shows you why the file is ignored. This is useful if you have multiple .gitignore files or some complex patterns in your rules.

git check-ignore -v path/to/a/file.png