Ignore .pyc files in git repository

Question:

How can I ignore .pyc files in git?

If I put it in .gitignore it doesn’t work. I need them to be untracked and not checked for commits.

Answer:

Put it in .gitignore. But from the gitignore(5) man page:

So, either specify the full path to the appropriate *.pyc entry, or put it in a .gitignore file in any of the directories leading from the repository root (inclusive).

Leave a Reply