简体   繁体   English

为什么我只编写一些代码时.git总是更大?

[英]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个分支( masterdevelop ),还有几个提交(因为这是一个新的仓库)

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)

gitlab repo information: gitlab回购信息:
gitlab回购信息

whatsize folder: whatsize文件夹:
whatsize文件夹

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.

相关问题 为什么我的Git存储库比工作目录大得多? - Why is my Git repository so much bigger than the working directory? 为什么这个git浅克隆比我预期的要大? - Why is this git shallow clone bigger than I expected? git会记录我编写代码的时间吗? 或只记录我git add的时间 - will git record the time when I write the code? or only record the time when I git add 当我 git stash 然后 git stash pop 时,我的更改总是未暂存 - When I git stash and then git stash pop my changes are always unstaged git pull 会不会覆盖我刚写的代码 - Will git pull overwrite the code I just wrote 为什么 Git 会写入我的文件? - Why does Git write to my files? git - 如何将我的应用程序切换为使用来自不同远程源的代码(不仅仅是 URL 更改,具有不同的 git 历史记录) - git - how do I switch my app to use code from a different remote origin (not just a URL change, has different git history) 我刚删除main函数时,可以链接到git的源代码吗? - Is it possible to link to the source code of git when I just remove the main function? 当我将文件添加到暂存区时,为什么Git会将文件存储在存储库中? - Why does Git store the file in the repository when I just add it to the staging area? 管道传输时,为什么git log输出会混乱? - Why is my git log output getting mangled when I pipe it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM