简体   繁体   中英

git-clone memory allocation error

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. :)

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.

如果远程计算机上的git由于内存限制而失败,您也可以尝试使用rsyncscp将存储库复制到本地计算机,然后继续从那里进行克隆。

You could run the git clone command with --depth -1 . This will only fetch the last commit, so operations that involve history (git log, blame, or even push/pull) may not work. But, it needs less memory usage, disk space, and network transfers.

The limitations are described there: Why can't I push from a shallow clone?

Maybe your local machine in 32 bits and the other server is 64 bits... I got a similar issue on Windows using MSysGit 32 bits. The git 64 bits from Cygwin did the job.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM