Git – suboptimal pack – out of memory – How to fix

I was cloning a remote repo to set up a local install and got a suboptimal pack - out of memory notice quickly followed by the fatal failure of the clone.

remote: Counting objects: 223484, done.
remote: warning: suboptimal pack - out of memory
error: pack-objects died of signal 91171/66888)
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

Man the ramparts! To the google!

This was helpful: https://stackoverflow.com/a/4829883/9661226

By default pack.windowMemory and pack.packSizeLimit are set to 0 (which means unlimited). Apparently, and this seems somewhat conceptually backwards in my head, setting a limit keeps the system from running out of memory.

So, run something like this on the remote you are pulling from:

git config pack.windowMemory 10m
git config pack.packSizeLimit 20m

This did the trick!

If it didn’t for you the above linked to SO answer lists some other configs and even mentions setting the configs locally too (suppose this could be for pushing large repos).

Leave a Reply

Your email address will not be published.