Which .gitignore rule is making my file ignored?

When you add a file to git and you get:
The following paths are ignored by one of your .gitignore files: your-file

you can check which .gitignore rule makes the path ignored using:
git check-ignore -v your-file

git check-ignore checks if file (or list of files) is ignored by git, -v makes the output more verbose, adding a .gitignore file name and line.