git-clone memory allocation error

git
12,009

Solution 1

Do you have big files in your repository (like log files for example) ?
Apparently, your repository is too big to be retrieved on your hard drive.

There are two things you can do :

  • Check for big files and remove them if they're not useful (not only by committing. But also by modifying your history. If you still have your big files in our repository, it won't be smaller.
  • Do a "git gc". It'll automatically cleanup unused files and compress the repository.

Solution 2

If git on the remote machine fails due to memory constraints you might also try rsync or scp to copy the repository to your local machine and continue with cloning from there.

Share:
12,009
nevan
Author by

nevan

Updated on June 09, 2022

Comments

  • nevan
    nevan almost 2 years

    I'm trying to run git clone and am receiving the following error:

    fatal: Out of memory, malloc failed
    fatal: index-pack died with error code 128
    fetch-pack from 'user@server:git' failed.
    

    I was able to successfully do a clone on my local machine, but it's failing when I try to clone to another server.

    Still somewhat new to this whole git thing, so any help would be greatly appreciated. :)

  • Emil Sit
    Emil Sit over 14 years
    git creates a new pack for each clone, containing the relevant objects for the cloner; so, I don't think git gc will help.
  • nevan
    nevan over 14 years
    Yeah, we overlooked a large file (in this case a zip archive) that seemed to be causing the problem. That link about modifying the history was a big help. Thanks for that.
  • Paul
    Paul over 13 years
    how do you do this on a remote branch?
  • Damien MATHIEU
    Damien MATHIEU over 13 years
    You can't manipulate a remote branch without getting it locally.
  • SinisterRainbow
    SinisterRainbow about 12 years
    git gc also causes this error for me (fatal: Out of memory, calloc failed)
  • ericbowden
    ericbowden almost 12 years
    git gc caused the same error for me until I actually deleted .git and reinitialized. Has something to do with the commit history.