The remote end hung up unexpectedly while git cloning

Viewed 516305

My git client repeatedly fails with the following error after trying to clone the repository for some time.

What could be the issue here?

Note: I have registered my SSH key with the GIT hosting provider

Receiving objects:  13% (1309/10065), 796.00 KiB | 6 KiB/s
fatal: The remote end hung up unexpectedly
41 Answers

Based on this answer, I tried following (with https url):

  1. initial cloning of repo:

git clone --depth 25 url-here

  1. fetch commits with increasing twice per try depth:

git fetch --depth 50

git fetch --depth 100

git fetch --depth 200

...and so on

  1. eventually (when I think enough is fetched) I run git fetch --unshallow - and it's done.

The process obviously takes much more time, but in my case setting http.postBuffer and core.compression didn't help.

UPD: I found out that fetching via ssh works for any repo size (discovered accidentally), done with git clone <ssh url>, given you have created ssh keys. Once repo is fetched, I change remote address using git remote set-url <https url to repo>

For shared bandwidth try to clone when load is less. Otherwise, try with a high speed connection. If still does not work, please use below command,

git config --global http.postBuffer 2048M
git config --global http.maxRequestBuffer 1024M
git config --global core.compression 9

git config --global ssh.postBuffer 2048M
git config --global ssh.maxRequestBuffer 1024M

git config --global pack.windowMemory 256m 
git config --global pack.packSizeLimit 256m

And try to clone again. You might need to change those settings according to your available memory size.

This is due the internet connectivity issue, i faced the same issue. I did a shallow copy of code using

git clone --depth 1 //FORKLOCATION

Later unshallowed the clone using

git fetch --unshallow

I got the same issue, I fixed this with trial and error method. I changed the core.compression value until it works.

I started with "git config --global core.compression 1" after 3 attempts

"git config --global core.compression 4" worked for me.

Wasted a few hours trying some of these solutions but eventually traced this to a corporate IPS (Instrusion Protection System) dropping the connection after a certain amount of data is transferred.

SOLVED WITH WIFI Router Setting :

I got same issue when I am in wifi with Settings PPPoE(auto login by wifi router).

Git download speed is very slow 15kb.

packet_write_wait: Connection to 17.121.133.16 port 22: Broken pipe fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed

Solution : 1. Changed setting to Dynamic IP, reboot wifi router. 2. From web browser login to Internet service provider portal (do not configure PPPoE , auto login from the wifi router).

After changing Git download speed is 1.7MiB.

use ssh instead of http, it's not a good answer for this question but at least it works for me

This solved my problem:

git clone --depth=20 https://repo.git -b master

The tricks above did not help me, as the repo was larger than the max push size allowed at github. What did work was a recommendation from https://github.com/git-lfs/git-lfs/issues/3758 which suggested pushing a bit at a time:

If your branch has a long history, you can try pushing a smaller number of commits at a time (say, 2000) with something like this:

git rev-list --reverse master | ruby -ne 'i ||= 0; i += 1; puts $_ if i % 2000 == 0' | xargs -I{} git push origin +{}:refs/heads/master

That will walk through the history of master, pushing objects 2000 at a time. (You can, of course, substitute a different branch in both places if you like.) When that's done, you should be able to push master one final time, and things should be up to date. If 2000 is too many and you hit the problem again, you can adjust the number so it's smaller.

I had to remove the branch flag for the git clone command.

On MacOSX High Sierra the solution for me was:

brew install git-lfs

and my repository was cloned without any errors.

Increasing postBuffer size and maxRequestBuffer will help you in this problem. Just follow the steps.

steps:

1 .Open terminal or Git Bash and with "cd" go to the location where you wanted to clone repo.

2.Set compression to 0

git config --global core.compression 0

3.Set postBuffer size

git config --global http.postBuffer 1048576000

4.Set maxRequestBuffer size

git config --global http.maxRequestBuffer 100M

5.Now start clone

git clone <repo url>

6.Wait till clone get complete.

Thank you. Happy Coding !!!

It might be because of commits' size that are being pushed.. Breakdown the number of commits by the following steps:

git log -5

See the last 5 commits and you would know which ones are not pushed to remote. Select a commit id and push all commits up to that id:

git push <remote_name> <commit_id>:<branch_name>

NOTE: I just checked my commit which could have the biggest size; first pushed up till then. The trick worked.!!

Faced same issue, try to merge with another branch and take a pull from them. It works for me same.

I had the same issue and was searching the solution around web. I found that our corporate routing in IPv6 is not maintained.

I turn off the (IPv6 option on the ethernet port in Windows 10) and there is no issue.

None of the suggested solutions worked for me when cloning a repository via ssh. However, I was able to clone using https, then later changed the remote to ssh via:

git remote set-url origin git@github.com:USERNAME/REPOSITORY.git

The only thing that worked for me was this:

  1. Clone shallow:

    git clone <yourrepo> --depth 10

  2. Edited .git/config as follows:

Before

[remote "origin"]
    fetch = +refs/heads/master:refs/remotes/origin/master

After

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
  1. git config --global http.maxRequestBuffer 100M git config --global core.compression 0

  2. Git fetch

For me the problem was with Norton Security installed on MacOS. Once I've temporary disabled firewall and other Norton protections, my git push worked correctly.

changing depth to 25 in source tree advanced options in the clone screen worked for me

Running the git push... from Mac terminal made the trick, which was different than trying from an IDE (my case: VSCode) which caused the issue.

My experience was that this was definitely a connectivity timeout somewhere.

Eventually solved by plugging in a crappy little wifi dongle to my PC, and using my phone's hotspot.

When I was on a wired connection to my ISP, it was fine uploading a small change to Github, so connectivity and authentication worked in principle. But when trying to push a new 80Mb repository, the error occurred.

After managing to push the repo over the wifi dongle / hotspot, small incremental changes went up fine.

Related