Reputation: 225
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?
Upvotes: 8
Views: 11059
Reputation: 1328712
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.
Upvotes: 8