使用git filter-branch然后git push --force清除大文件后,远程(Gitlab)上的Git存储库大小仍然很大 [英] Git repository size remains large on remote (Gitlab) after purging of large files with git filter-branch then git push --force

查看:1068
本文介绍了使用git filter-branch然后git push --force清除大文件后,远程(Gitlab)上的Git存储库大小仍然很大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了Gitlab文档上有关使用Git减少存储库大小"的说明 通过清除历史记录中的大文件: https://docs.gitlab.com/ee/user/project/仓库/reducing_the_repo_size_using_git.html
这些说明(我引用)如下:

I have followed the instructions on Gitlab's docs about "Reducing the repository size using Git " by purging of large files from history: https://docs.gitlab.com/ee/user/project/repository/reducing_the_repo_size_using_git.html
The instructions, and I quote, are as follows:

git checkout master
git filter-branch --force --tree-filter 'rm -f path/to/big_file.mpg' HEAD
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push --force origin master

然后我删除了本地存储库,并再次从远程克隆,大小已从克隆时的600mb减小到90mb,但仍然在Gitlab存储库页面上说大小为600mb.

I then deleted my local repository, and cloned again from remote, the size has been reduced, from 600mb to 90mb upon cloning, but still on the Gitlab repository page it says the size is 600mb.

有人知道我为什么会看到这种行为,以及如何解决此问题吗?

Does anyone know why I'm seeing this behavior, and how to fix it?

推荐答案

我从Gitlab文档引用:

It was an error on my behalf not reading the docs thoroughly, I quote from the Gitlab docs:

请注意,即使使用该方法,直到git gc在GitLab端运行, 已删除"的提交和Blob仍然存在.如果提交 是否曾经包含在MR中,或者是否为提交而运行了构建,或者 用户对此进行了评论,它也会保留在原处.因此,在这些情况下 大小不会减小.

Note that even with that method, until git gc runs on the GitLab side, the "removed" commits and blobs will still be around. And if a commit was ever included in an MR, or if a build was run for a commit, or if a user commented on it, it will be kept around too. So, in these cases the size will not decrease.

这篇关于使用git filter-branch然后git push --force清除大文件后,远程(Gitlab)上的Git存储库大小仍然很大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆