The remote end hung up unexpectedly while git clon

2019-01-01 03:07发布

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

标签: git
27条回答
流年柔荑漫光年
2楼-- · 2019-01-01 03:08

If you are using https and you are getting the error.

I used https instead of http and it solved my problem

git config --global https.postBuffer 524288000
查看更多
看淡一切
3楼-- · 2019-01-01 03:08

I was facing this issue when cloning data (via HTTP) from remote git repo hosted on AWS EC2 instance managed by elastic beanstalk. The cloning itself was also done on AWS EC2 instance.

I tried all aforementioned solutions and their combinations:

  • setting git's http.postBuffer
  • settinghttp.maxrequestbuffer
  • turning off git compression and trying "shallow" git clone and then git fetch --unshallow - see fatal: early EOF fatal: index-pack failed
  • tunning GIT memory settings - packedGitLimit et al, see here: fatal: early EOF fatal: index-pack failed
  • tunning nginx configuration - setting client_max_body_size to both big value and 0 (unlimited); setting proxy_request_buffering off;
  • setting options single-request in /etc/resolv.conf
  • throttling git client throughput with trickle
  • using strace for tracing git clone
  • considering update of git client

After all of this, I was still facing the same issue over and over again, until I found that issue is in Elastic Load Balancer (ELB) cutting the connection. After accessing the EC2 instance (the one hosting git repo) directly instead of going through ELB I've finally managed to clone git repo! I'm still not sure which of ELB (timeout) parameters is responsible for this, so I still have to do some research.

UPDATE

It seems that changing Connection Draining policy for AWS Elastic Load Balancer by raising timeout from 20 seconds to 300 seconds resolved this issue for us.

The relation between the git clone errors and "connection draining" is strange and not obvious to us. It might be that connection draining timeout change caused some internal changes in ELB configuration that fixed the issue with premature connection closing.

This is the related question on AWS forum (no answer yet): https://forums.aws.amazon.com/thread.jspa?threadID=258572

查看更多
高级女魔头
4楼-- · 2019-01-01 03:08

I found my problem to be with the .netrc file, if so for you too then you can do the following:

Open your .netrc file and edit it to include github credentials. Type nano ~/netrc or gedit ~/netrc

Then include the following: *machine github.com

login username

password SECRET

machine api.github.com

login username

password SECRET*

You can include your raw password there but for security purposes, generate an auth token here github token and paste it in place of your password.

Hope this helps someone

查看更多
梦该遗忘
5楼-- · 2019-01-01 03:08

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

查看更多
倾城一夜雪
6楼-- · 2019-01-01 03:09

I also had the same problem.The reason for this problem is as Kurtis's descriptions about GNUTLS.

If you have the same reason and your system is Ubuntu, you can solve this problem by installing the latest version of git from ppa:git-core/ppa.The commands are as below.

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get git
查看更多
泛滥B
7楼-- · 2019-01-01 03:14

I have the same error while using BitBucket. What I did was remove https from the URL of my repo and set the URL using HTTP.

git remote set-url origin http://mj@bitbucket.org/mj/pt.git
查看更多
登录 后发表回答