A file that is already being tracked will not be ignored: you must first remove it from the index.
git rm --cached private.xml git add -u . git commit -m "Record deletion of private.xml from the index"
( --cached make sure the file remains on disk)
Then you can add it to .gitignore (no need for '*')
private.xml
Note: whenever a file is ignored or not ignored, you can check which .gitignore rule applies with:
git check-ignore -v
source share