Git push: fatal: Out of memory, malloc failed

When I click on a remote server, I get an error message:

Counting objects: 58, done. Compressing objects: 100% (35/35), done. fatal: Out of memory, malloc failed (tried to allocate 595059947 bytes) error: pack-objects died of signal 13 error: failed to push some refs to ' git@cassandra.predictioninstitute.com :development'" 

I think the problem is that I accidentally included some very large log files. But I subsequently deleted them (git rm logfile), but the error remains. And they do not appear in git status. How can I recover from this?

+7
source share
3 answers

I could not say from your comment if you objected to rewriting the story or did not mind. If you do not mind, this command will delete large files from your history.

Warning: it is destructive and irreversible. First back up your repository. If you do not like the results, you can simply restore the backup:

 git filter-branch --index-filter 'git rm --cached --ignore-unmatch <file>' \ --prune-empty --tag-name-filter cat -- --all 

This command will remove the <file> from the history of your branch. Run it for each file, causing problems.

+3
source

The following command fixed the problem for me:

 git config --global pack.windowMemory 256m 

This affects the efficiency of delta compression, so you can try a larger size first, something like 1g, depending on your hardware and bandwidth.

More details here: https://www.kernel.org/pub/software/scm/git/docs/git-pack-objects.html

+3
source

I experienced this error by clicking on git-repo hosted on raspberry pi. One of the files I tried to click is larger than the available memory (memory + swap) on the git server.

Fixed issue by temporarily creating a new swap file on git server:

dd if=/dev/zero of=/media/store/swapfile bs=1024 count=655360

mkswap /media/store/swapfile

swapon /media/store/swapfile

Verify that a new swap partition has been added:

swapon , cat /proc/swaps or free

(I do not want to add the swap file to /etc/fstab , so after rebooting the swap file will be deleted.)

0
source

All Articles