I have googled and found many solutions but none work for me.
I am trying to clone from one machine by connecting to the remote server which is in the LAN network.
It's confusing because Git logs may suggest any connection or ssh authorization errors, eg: ssh_dispatch_run_fatal: Connection to x.x.x.x port yy: message authentication code incorrect
, the remote end hung up unexpectedly
, early EOF
.
Server-side solution
Let's optimize git repository on the server side:
Eg:
ssh admin@my_server_url.com
sudo su git
cd /home/git/my_repo_name # where my server's bare repository exists.
git gc
git repack -A
Now I am able clone this repository without errors, e.g. on the client side:
git clone git@my_server_url.com:my_repo_name
The command git gc
may be called at the git client side to avoid similar git push
problem.
If you are an administrator of Gitlab service - trigger Housekeeping manually. It calls internally git gc
or git repack
.
Client-side solution
Other (hack, client-side only) solution is downloading last master without history:
git clone --single-branch --depth=1 git@my_server_url.com:my_repo_name
There is a chance that buffer overflow will not occur.
First, turn off compression:
git config --global core.compression 0
Next, let's do a partial clone to truncate the amount of info coming down:
git clone --depth 1 <repo_URI>
When that works, go into the new directory and retrieve the rest of the clone:
git fetch --unshallow
or, alternately,
git fetch --depth=2147483647
Now, do a regular pull:
git pull --all
I think there is a glitch with msysgit in the 1.8.x versions that exacerbates these symptoms, so another option is to try with an earlier version of git (<= 1.8.3, I think).
I tried all of that commands and none works for me, but what works was change the git_url to http instead ssh
if is clone command do :
git clone <your_http_or_https_repo_url>
else if you are pulling on existing repo, do it with
git remote set-url origin <your_http_or_https_repo_url>
hope this help someone!
Network quality matters, try to switch to a different network. What helped me was changing my Internet connection from Virgin Media high speed land-based broadband to a hotspot on my phone.
Before that I tried the accepted answer to limit clone size, tried switching between 64 and 32 bit versions, tried disabling the git file cache, none of them helped.
Then I switched to the connection via my mobile, and the first step (git clone --depth 1 <repo_URI>) succeeded. Switched back to my broadband, but the next step (git fetch --unshallow) also failed. So I deleted the code cloned so far, switched to the mobile network tried again the default way (git clone <repo_URI>) and it succeeded without any issues.
This error may occur for memory needs of git. You can add these lines to your global git configuration file, which is .gitconfig
in $USER_HOME
, in order to fix that problem.
[core]
packedGitLimit = 512m
packedGitWindowSize = 512m
[pack]
deltaCacheSize = 2047m
packSizeLimit = 2047m
windowMemory = 2047m
This worked for me, setting up Googles nameserver because no standard nameserver was specified, followed by restarting networking:
sudo echo "dns-nameservers 8.8.8.8" >> /etc/network/interfaces && sudo ifdown venet0:0 && sudo ifup venet0:0