即使删除 .git 目录后,Git 存储库仍然太大
我有一个 3.6GB 的存储库。为了清理这个问题,我删除了所有大文件,然后将删除的内容推送到 BitBucket 中托管的远程 git 存储库。之后,我删除了本地的 .git 目录。我执行了 git init 并将所有现有文件推送到现有的远程存储库。
尽管如此,BitBucket 仍然告诉我该存储库太大了?我在互联网上查看了各种解决方案,但它们似乎都引用了 BFG 和其他清洁工具。我的印象是所有这些脚本都只是清理 .git。通过删除 .git,我希望任何不必要的文件都会被删除,但事实显然并非如此。
如果我的 .git 目录不是问题,我想知道还会是什么?
I have a repo that is 3.6GB. In order to clean this up, I removed all large files then pushed the deletions to the remote git repo hosted in BitBucket. After this, I deleted my .git directory on my local. I did git init and pushed all the existing files to the existing remote repo.
Despite this, BitBucket is still telling me that the repo is too big? I looked at various solutions on the internet but all of them seem to be referencing BFG and other cleaning tools. I was under the impression that all of these scripts just clean up .git. By deleting .git I was hoping that any unnecessary files would be deleted but that's clearly not the case.
If my .git directory is not the issue, I was wondering what else it could be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除本地
.git
目录不会删除远程 Git 目录,该目录仍包含所有旧内容,包括存储库的早期历史记录以及曾经提交给它的每个文件的每个版本。如果删除所有引用,使得存储库的整个历史记录不再能够从任何现有分支访问,那么 Git 最终应该对它进行垃圾收集,如果我没记错的话,可能大约两周。如果您有 shell 访问权限,则可以 运行 <代码>git gc你自己。
如果您确实不想要任何项目的历史记录,那么最好的选择是删除并重新创建远程存储库。
Deleting your local
.git
directory doesn't delete the remote Git directory, which will still contain all the old stuff, including the earlier history of the repo and every version of every file ever committed to it.If you delete all references such that the entire history of the repository is no longer reachable from any existing branch, then Git should garbage collect it eventually, possibly around two weeks if I recall correctly. If you have shell access, you can run
git gc
yourself.Your better bet is to delete and recreate the remote repo, if you truly don't want any of the project's history.