简体   繁体   中英

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.

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.
I just have 2 branch ( master and develop ), and several commits (because it is a new repo)

Then I keep searching the solution , with git command:

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)

gitlab repo information:
gitlab回购信息

whatsize folder:
whatsize文件夹

As commented, make sure your .gitignore will ignore any generated binary.

Try first to remove anty big files from your past commits, with BFG Repo cleaner ( faster than the native git filter-branch )

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
git repack -Ad      # kills in-pack garbage
git prune           # kills loose garbage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM