.gitignore
only applies to untracked files. If you are tracking a .pyc
then .gitignore
won't apply. Remove the .pyc
with git rm
and next time you do a git status
it (and any others) won't show up in the list of untracked file and nor will it be automatically added.
Otherwise if you need to ignore a file already under version control, update the index to ignore changes to files already under version control:
git update-index --assume-unchanged
For more information please see git-update-index(1) Manual Page, the related answer to .gitignore file not ignoring and the related answer to question (GIT: Ignoring Version-Controlled Files).