So I'm using git on a personal server and I had an old repo that I needed to update. I removed a bunch of old files and committed and pushed the change. I'm using a web UI for it on my server (Gitlist). When I use this GUI to download the repo as a zip file, it comes out to the correct size, about 41MB. However, when I clone the repo, it comes out to something closer to a gig due to the size of one of the ./git/objects/pack
files is about 900MB.
Why is the repo so large when it really should be much smaller?
But, even in that case, you keep on committing large files, your git repo size may increase due to the version history. You have to reduce your git repo size in order to work it seamlessly. Ideally, we should keep your repository size to between 100MB and 300MB.
We recommend repositories remain small, ideally less than 1 GB, and less than 5 GB is strongly recommended. Smaller repositories are faster to clone and easier to work with and maintain.
Pushing a commit which removes files doesn't lake the git repo smaller.
You need to remove those files across the history of the git repo in order for it size to shrink.
This is typically done with a combination of git filter-branch
and git gc --aggressive --prune=now
: see "Reduce git repository size".
(Don't forget: a git gc
alone can actually increase the size of the repo!)
To remove large files, the tool BFG can help too.
In short, don't mix-up:
The HEAD that you download as a zip is indeed smaller (you removed files).
But the full history still references them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With