I was recently running into some issues where I had a massive git repo (12G). It was originally 2G. Since this cloned repo is used by the continuous integration system, I end up doing a lot of git checkout — . on the repo in order to get it back to a state where any of the changes I made to build it are removed. However, this constant head switching caused some cruft to accumulate over the past 2 months and now we’re in a spot where the repo is just way to massive.
So I attempted to run git gc on the repository but ended up with the following issue.
[tomcat@aa-cruisecontrol starter_relate_int]$ git gc
Counting objects: 160591, done. Delta compression using up to 4 threads. fatal: Out of memory? mmap failed: Cannot allocate memoryerror: failed to run repack [tomcat@aa-cruisecontrol starter_relate_int]$
After attempting a couple more attempts I still could not repack it. So I ended up blowing it away and recloning it. This reduced the size of the git repository to 2G. Draconinan yes, but I am glad to have the space.