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.