Remove .pyc files from Git remote repository
This works for me,
find . -name '*.pyc' | xargs -n 1 git rm --cached
git rm *.pyc --cached
git commit -a -m'remove pyc from index'
git push
PS: I see the date of question, but this solution looks better, imho. May be it'll help someone.. .
No, you cannot delete them directly from the BitBucket interface but you can delete them in your local checkout and find ./ -type f -name '*.pyc' -exec git rm {} \;
( or simply git rm each pyc file one by one ). Then commit/push your changes.
Finally, to avoid ever making the same mistake again you may create a file at the root of your repo and name it '.gitignore' with the contents:
*.pyc
*~
*.swp
*~ and ~.swp are other commonly forgotten file types that are often accidentally pushed. See the github doc on gitignore https://help.github.com/articles/ignoring-files (and their repo of .gitignore files for some nice defaults).
- Remove
.pyc
files usinggit rm *.pyc
. If this not work usegit rm -f *.pyc
- Commit
git commit -a -m 'all pyc files removed'
- Push
git push
- In future commits you can ignore
.pyc
files by creating a.gitignore
file