Reputation: 58632
I ran git pull on my Ubuntu VM, and I got
Enter passphrase for key '/root/.ssh/id_rsa':
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (7/7), done.
From bitbucket.org:bheng/app
7406b4e..8f5e3dc master -> origin/master
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 5384, done.
fatal: Out of memory, malloc failed (tried to allocate 306851376 bytes)
error: failed to run repack
Updating 7406b4e..8f5e3dc
Fast-forward
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 5384, done.
fatal: Out of memory, malloc failed (tried to allocate 306851376 bytes)
error: failed to run repack
resources/views/layouts/fe/meta.blade.php | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
As you can see at the end - it pull in my local changes fine.
But I just want to get rid of those errors, how do I get rid of them? Clear my cache?
I saw git gc
is the recommended command to clean local files, but I can't even run that.
Counting objects: 7709, done.
fatal: Out of memory, malloc failed (tried to allocate 306851376 bytes)
error: failed to run repack
I also tried
git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (2377/2377), done.
dangling commit 32c8482dcc118bd64c1f8e45ee093c286a840e5d
dangling commit abce13f3bfb8c3833c7b76f4aea9cd28caa3af03
dangling blob c9131033c721c0b90c86bf7b32377588354363ec
dangling commit de6d83d883d35f97cb211233e2283c9d79e6f922
dangling blob d535c98d611cca74af45633c77680bb2bdc5e55a
Finally, run git pull
one more time got this
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 5384, done.
fatal: Out of memory, malloc failed (tried to allocate 306851376 bytes)
error: failed to run repack
Already up-to-date.
Upvotes: 2
Views: 4790
Reputation: 3093
Your RAM size may will be lower, you have to Add Swap Space. I had done it in ubuntu 16.04 and solved this issue
The below code displays if swap
free -h
if swap is zero then check there is enough memory to add the swap
df -h
My RAM is 1 GB so allocating 1GB to swap space also
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
This will display something like this, then success
NAME TYPE SIZE USED PRIO
/swapfile file 1024M 0B -1
Thanks
Upvotes: 2
Reputation: 1820
Try following the instructions here: https://stackoverflow.com/a/8761464/1278288
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1"
It should reduce the memory needed.
It's a good idea to have at least 1gb of swap though.
Upvotes: 0
Reputation: 38619
Well, your system is simply out of RAM. Git regularly runs git gc
if needed and that is where the error message comes from as you also can see when running it manually. It tries to repack your Git repository and it fails when trying to allocate 293 MiB additional RAM. Put more RAM into your box or at least enlarge the swap size, even if only temporary to make the repack finish successfully. You can easily add some swap file while the system is running if you only want to make this temporarily to help the repack to finish. Documentation can be found at https://help.ubuntu.com/community/SwapFaq#Four-step_Process_to_Add_Swap_File without doing the last step if only temporary.
Upvotes: 3