[英]Why my .git is always bigger when I just write a few code?
This happen twice: I already erased my repo, because of a filesize too big (>100mb), then it always failed when get test in CI/CD GitLab. 这发生了两次:由于文件大小太大(> 100mb),我已经删除了我的仓库,然后在CI / CD GitLab中进行测试时总是失败。
So i create the new repo, ... and it happens again: when I check my folder size, the main problem is .git
: I dont know what happen and I don't know the solution. 因此,我创建了新的存储库,并再次发生:当我检查文件夹大小时,主要问题是
.git
:我不知道会发生什么,也不知道解决方案。
I just have 2 branch ( master
and develop
), and several commits (because it is a new repo) 我只有2个分支(
master
和develop
),还有几个提交(因为这是一个新的仓库)
Then I keep searching the solution , with git command: 然后,我继续使用git命令搜索解决方案:
git gc --aggresive --prune=now
but still .git
pack so huge, so I really need your help to find this solution, because I don't want to erase my repo again and the problem came again my new repo (so bigg) 但是
.git
pack仍然很大,所以我真的需要您的帮助才能找到此解决方案,因为我不想再次擦除我的仓库,而问题又来了我的新仓库(so bigg)
As commented, make sure your .gitignore
will ignore any generated binary. 如前所述,请确保您的
.gitignore
将忽略任何生成的二进制文件。
Try first to remove anty big files from your past commits, with BFG Repo cleaner ( faster than the native git filter-branch
) 首先尝试使用BFG Repo清理程序 (比本地
git filter-branch
更快)从过去的提交中删除anty大文件。
java -jar bfg.jar --strip-blobs-bigger-than 2M some-big-repo.git
Only then you can apply git gc/repack/prune in order for the size to actually go down. 只有这样,您才能应用git gc / repack / prune来使大小实际减小。
git gc
git repack -Ad # kills in-pack garbage
git prune # kills loose garbage
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.