Git really is running out of memory. When I try this locally (using file:// to force Git to go through the same git-upload-pack dance that it does over a smart transport, and using ulimit -v as a poor but probably sufficient approximation of a RAM-limited server), it fails with 920 MB of virtual memory and succeeds with 940 MB:
$ git clone -u 'ulimit -v 920000; git upload-pack' file:///tmp/_test_botch.git Cloning into '_test_botch'... remote: Counting objects: 1114, done. remote: warning: suboptimal pack - out of memory remote: fatal: mmap failed: Cannot allocate memory error: git upload-pack: git-pack-objects died with error. fatal: git upload-pack: aborting due to possible repository corruption on the remote side. remote: aborting due to possible repository corruption on the remote side. fatal: early EOF fatal: index-pack failed $ git clone -u 'ulimit -v 940000; git upload-pack' file:///tmp/_test_botch.git Cloning into '_test_botch'... remote: Counting objects: 1114, done. remote: warning: suboptimal pack - out of memory remote: Compressing objects: 100% (599/599), done. remote: Total 1114 (delta 734), reused 811 (delta 495) Receiving objects: 100% (1114/1114), 196.51 MiB | 8.58 MiB/s, done. Resolving deltas: 100% (734/734), done. Checking out files: 100% (367/367), done. This shouldn’t be that surprising, as over 1 GB of actual content is stored in the repository. (Why is botch so gigantic? It looks like there may be a ton of unnecessary temporary data in tests/*/tmp and tests/*/out.) Git automatically runs ‘git gc --auto’ every so often to optimize the repository. However, in this case, ‘git gc --auto’ does not detect that anything needs to be done: you have only 172 < 6700 (gc.auto) loose objects and 4 < 50 (gc.autoPackLimit) packs. Perhaps the packs are of particularly poor quality due to previous instances of “warning: suboptimal pack - out of memory”. As you found, manually running ‘git gc’ does significantly improve the situation: after that, a clone succeeds with just 260 MB because there is nothing to be recompressed. Anders