Reputation: 6697
It's two days I'm trying to pull my project (which is on git) on my server. My server has 1GB ram and uses Ubuntu OS. (usually 200mb of RAM is used by other processes).
When I run git pull origin master
on the server, It throws this:
fatal: Out of memory, malloc failed (tried to allocate 533517295 bytes)
fatal: index-pack failed
Also here is the result of nano .git/config
:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
packedGitLimit = 512m
packedGitWindowSize = 512m
[remote "origin"]
url = https://***@bitbucket.org/***/***.g$
fetch = +refs/heads/*:refs/remotes/origin/*
[pack]
threads = 1
deltaCacheSize = 512m
packSizeLimit = 512m
windowMemory = 512m
Honestly I cannot get more RAM for my server. Any idea how can I pull my project on the server?
Noted that in reality there are real names instead of ***
.
Upvotes: 0
Views: 313
Reputation: 18834
To limit the amount of memory used during a fetch operation (git pull
uses git fetch
), you can use the --depth
flag.
Just run git pull --depth=10
and increase to number to fetch more and more history (or decrease it if you also run out of memory). Once you have enough objects loaded in history, you can request the remainder object using git fetch --unshallow
The downside of pulling with depth is the fact that your repository will take more space on disk, as it also has to account for the multiple states of the repo
Upvotes: 1