Git repository size remains large on remote (Gitlab) after purging of large files with git filter-branch then git push --force

99封情书 提交于 2020-01-24 14:17:29

问题


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

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?


回答1:


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

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.



来源:https://stackoverflow.com/questions/51213156/git-repository-size-remains-large-on-remote-gitlab-after-purging-of-large-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!