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
If you are using https and you are getting the error.
I used https instead of http and it solved my problem
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:
http.postBuffer
http.maxrequestbuffer
git clone
and thengit fetch --unshallow
- see fatal: early EOF fatal: index-pack failedpackedGitLimit
et al, see here: fatal: early EOF fatal: index-pack failedclient_max_body_size
to both big value and 0 (unlimited); settingproxy_request_buffering off;
options single-request
in /etc/resolv.confgit clone
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
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
orgedit ~/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
use
ssh
instead ofhttp
, it's not a good answer for this question but at least it works for meI 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.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
.