Git clone fails with out of memory error - "fatal: out of memory, malloc failed (tried to allocate 905574791 bytes) / fatal: index-pack failed" Git clone fails with out of memory error - "fatal: out of memory, malloc failed (tried to allocate 905574791 bytes) / fatal: index-pack failed" git git

Git clone fails with out of memory error - "fatal: out of memory, malloc failed (tried to allocate 905574791 bytes) / fatal: index-pack failed"


git clone will not look at your pack.packSizeLimit setting, it'll anyway transfer everything in a single pack - unless it changed since the last time I looked.

Using SCP or Rsync might be a way to work around your issue indeed. Removing the "useless" large files, then repacking the repository you try to clone could also help.

Giving more RAM to the VM might also help - I don't think you'll need a 64-bits address space to allocate 900MB... You could also give it enough SWAP space to handle the 900MB package instead of increasing the RAM.


I got a similar issue on Windows using MSysGit 32 bits.The git 64 bits from Cygwin did the job.Maybe you should use a 64 bits Debian VM (instead of 32 bits one).

My original answer is available on question Git on Windows, “Out of memory - malloc failed”.


Today I had the same issue. Git server ran out of memory, but gitlab reported that there is still memory available. We checked memory with htop (reported none available), restarted gitlab and everything went back to normal.