我试图从 BitBucket 存储库中删除目录venv
(虚拟环境)。我已将venv/
的条目添加到.gitignore
文件中,但venv
在首次提交到存储库时上传。
在this answer中,作者说我必须清理缓存。
git rm -r --cached .
git add .
git commit
On branch master
Your branch is up-to-date with 'origin/master'.
所以我查看了 BitBucket 帐户,我仍然看到venv
目录和文件。
git status --ignored
返回:
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
venv/Lib/site-packages/pip/_vendor/distlib/t32.exe
venv/Lib/site-packages/pip/_vendor/distlib/t64.exe
venv/Lib/site-packages/pip/_vendor/distlib/w32.exe
venv/Lib/site-packages/pip/_vendor/distlib/w64.exe
venv/Lib/site-packages/setuptools/cli-32.exe
venv/Lib/site-packages/setuptools/cli-64.exe
venv/Lib/site-packages/setuptools/cli-arm-32.exe
venv/Lib/site-packages/setuptools/cli.exe
venv/Lib/site-packages/setuptools/gui-32.exe
venv/Lib/site-packages/setuptools/gui-64.exe
venv/Lib/site-packages/setuptools/gui-arm-32.exe
venv/Lib/site-packages/setuptools/gui.exe
venv/Scripts/django-admin.exe
venv/Scripts/easy_install-2.7.exe
venv/Scripts/easy_install.exe
venv/Scripts/pip.exe
venv/Scripts/pip2.7.exe
venv/Scripts/pip2.exe
venv/Scripts/python.exe
venv/Scripts/pythonw.exe
venv/Scripts/wheel.exe
nothing to commit, working directory clean
我发现有些文件不存在。例如django-admin.exe
,但为什么还有其他文件?
答案 0 :(得分:0)
您需要:
git rm -r --cached venv
echo venv/>.gitignore
git add .
git commit -m "Remove venv tracked content and ignores it"
git push
然后,您将不会再在远程BitBucket存储库上看到venv。
如果您的.gitignore
已经 忽略了venv/
文件夹内容,请使用以下方法检查是否仍然存在:
git check-ignore -v -- venv/aFile