【Git】从Git远程存储库中删除所有.pyc编译文件;附常用gitignore配置
生活随笔
收集整理的這篇文章主要介紹了
【Git】从Git远程存储库中删除所有.pyc编译文件;附常用gitignore配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題
提交的時候使用git add --all,然后把所有文件都推送到了遠程倉庫中。
現在我想在遠程倉庫中刪除它們,例如*.pyc文件。
解決方式
git rm *.pyc --cached刪除的時候,如果遇到報錯fatal: pathspec 'xxx.pyc' did not match any files的情況,可能是因為沒提交…我解決方式是commit一下,然后push上去,就好了,不知道為啥。有可能是因為.gitignore沒有提交,占用了某些文件吧。
附:常用的.gitignore配置
# Created by .ignore support plugin (hsz.mobi) ### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class *.pyc# C extensions *.so# Distribution / packaging .Python build/ develop-eggs/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ *.egg-info/ .installed.cfg *.egg# PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec# Installer log pip-log.txt pip-delete-this-directory.txt# Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/# Translations *.mo *.pot# Django stuff:local_settings.py# Flask stuff: instance/ .webassets-cache# Scrapy stuff: .scrapy# Sphinx documentation docs/_build/# PyBuilder target/# Jupyter Notebook .ipynb_checkpoints# pyenv .python-version# celery beat schedule file celerybeat-schedule# SageMath parsed files *.sage.py# Environments .env .venv env/ venv/ ENV/# Spyder project settings .spyderproject .spyproject# Rope project settings .ropeproject# mkdocs documentation /site# mypy .mypy_cache/.idea .update migrations總結
以上是生活随笔為你收集整理的【Git】从Git远程存储库中删除所有.pyc编译文件;附常用gitignore配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【WebPack】引入Vue;认识Plu
- 下一篇: 【SpringBoot】SpringBo