150

I'm having trouble cloning a repo on git. I've been trying for to days and have tried quite a few solutions (in most the problem was slightly different but seemed to apply) but nothing has done anything to make a difference.

I've tried switching off the anti-virus and firewall but that didn't help. I've also tried uninstalling and reinstalling the network adapter drivers (and restarting the computer) and that didn't work.

From what I understand it's a network issue somewhere as the remote server keeps hanging up but I'm not managing to get anywhere with the issue.

Using git clone -v --progress seemed to give the same output as git clone. Output from git clone -v --progress https://github.com/mit-cml/appinventor-sources.git

Cloning into 'appinventor-sources'...
POST git-upload-pack (gzip 1425 to 774 bytes)
remote: Counting objects: 41649, done.
remote: Compressing objects: 100% (7/7), done.
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

I've now tried increasing the buffer again

git config --global http.postBuffer 1048576000

but still nothing.

I'm following the solution from The remote end hung up unexpectedly while git cloning for troubleshooting.

7
  • 1
    Several other solutions sugggest increasing your push buffer size, have you tried that? In general, can you rule out the solutions you've already tried? Commented Sep 15, 2017 at 6:25
  • My brain's a bit frazzled so I can only remember those. Think I may have tried 2 or 3 more, if I think of them I'll add them. For now I'll try buffer size, thanks. Commented Sep 15, 2017 at 6:43
  • 1
    I increased buffer size git config --global http.postBuffer 524288000, no change. Is 500M okay? Commented Sep 15, 2017 at 7:10
  • 1
    I saw a solution which mentioned a hotfix support.microsoft.com/en-us/help/981344/…. I haven't applied the fix but I'm guessing if that was the problem turning off the anti-virus and firewall would have worked too Commented Sep 15, 2017 at 7:24
  • One thing I considered is that SSL is not the latest version. I'm using Git for Windows which has OpenSSL 1.0.2l. This is the previous version. Would that make a difference? Commented Sep 15, 2017 at 9:25

31 Answers 31

169

I resolved the same problem by this:

git config http.postBuffer 524288000

It might be because of the large size of the repository and the default buffer size of git so by doing above (on git bash), git buffer size will be increased.

6
  • 2
    wow. Guess there's a first time for everything. Never thought I'd see a repo too large to manage. Do you know if this needs to be managed in some way? I would imagine this would continue to happen the larger it grows right
    – Barry
    Commented Sep 18, 2019 at 23:05
  • 22
    Use git init before git config http.postBuffer 524288000 Commented Sep 21, 2019 at 1:02
  • 19
    Another option is a global configuration: git config --global http.postBuffer 524288000 Commented Nov 20, 2019 at 18:21
  • 5
    Note that the Git FAQ explains that this is almost always due to broken software, like a proxy, antivirus, firewall, or TLS MITM device, and that software should be fixed or replaced rather than being worked around. It also has no effect on clones or fetches or SSH, only on pushes over HTTP(S).
    – bk2204
    Commented Feb 27, 2021 at 14:29
  • 1
    I would be quite surprised if this config step were necessary solely due to the size of the repository. The size of the repo and the size of buffers used during communication are two different things entirely. Changing buffer sizes could affect upload and download speeds, but no such change should be necessary due to the size of the repository. I've worked with huge repos, and I've never had to do anything like this.
    – CryptoFool
    Commented Dec 9, 2022 at 6:29
43

I had the same issue, and I have solved it by changing my net connection. In fact, my last internet connection was too slow (45 kbit/s). So you should try again with a faster net connection.

5
  • 6
    This seemed like the simplest fix for me to try first... Surprisingly, switching from wifi to ethernet did indeed solve this for me too.
    – rob_james
    Commented Jun 11, 2018 at 7:21
  • 1
    switching to a better network connection did help me. Thanks a lot :) Commented Oct 12, 2020 at 5:17
  • 1
    Switching to a better network connection worked for me too. Thanks. :)
    – minitechi
    Commented Jan 25, 2022 at 4:38
  • 1
    Weird problem. Switching to another network also helped me
    – max
    Commented Dec 12, 2022 at 11:45
  • This solved the problem for me - could not clone - connection was reset.
    – drlolly
    Commented Feb 19 at 14:49
24

I had the same problem, and @ingyhere 's answer solved my problem .
follow his instructions told in his answer here.

git config --global core.compression 0
git clone --depth 1 <repo_URI>
# cd to your newly created directory
git fetch --unshallow 
git pull --all
5
  • 1
    If I do it this way git does not find my branch when I try checking it out... Commented Nov 29, 2019 at 7:36
  • I've no idea about it. let me know if you found the reason by posting as answer or just leaving a comment. thanks. Commented Nov 29, 2019 at 8:16
  • 2
    I ended up doing it as I already was, I just had to try it like 10 times till it worked... Not sure why Commented Nov 30, 2019 at 9:07
  • 1
    This was worked for me but during following the steps i was getting error....i tried 2-3 times and finally able to finish the steps to complete...+1
    – imdadhusen
    Commented Jul 3, 2020 at 12:04
  • 3
    This worked with git config http.sslVerify "false"
    – Sithu
    Commented May 10, 2022 at 7:10
20

you need to increase the buffer size (it's due to the large repository size), so you have to increase it

git config http.postBuffer 524288000

Althought you must have an initialized repository, just proceed as the following

git init
git config http.postBuffer 524288000
git remote add origin <REPO URL>
git pull origin master
...
1
  • @HosseinKurd try again ;)
    – Smaillns
    Commented May 5, 2021 at 21:45
17
git config --global http.postBuffer 524288000

Work in my case - AWS code commit

12

This happens when you push first time without net connection or poor net connection.But when you try again using good connection 2,3 times problem will be solved.

2
  • 2
    Yup can confirm, I had to retry like 10 times and suddenly I could clone the repo...
    – Leojet
    Commented Feb 20, 2020 at 21:39
  • This is the best solution :) Worked like a charm Commented Jul 2, 2021 at 4:12
8

Uninstalling(version: 2.19.2) and installing(version: 2.21.0) git client fixed the issue for me.

2
  • 9
    Not. Upgrading from git version 2.18 to 2.21.0 did not solve the problem! Commented Apr 4, 2019 at 10:21
  • in my case updating to 2.40 solve problem, but i run these commands before: git config http.timeout 600 git config --global http.postBuffer 524288000 Commented Mar 31, 2023 at 7:00
7

I have tried "git init" and it worked like charm for me.

I got it from the link Git push error: RPC failed; result=56, HTTP code = 200 fatal: The remote end hung up unexpectedly fatal

0
7

(based on anser from Hakan Fıstık)

You can also set the postBuffer globally, which might be necessary, if you haven't checkout out the repository yet!

git config http.postBuffer 524288000
3
  • Using this command in terminal giving me error fatal: not in a git directory
    – Niraj
    Commented Dec 3, 2020 at 10:55
  • 1
    @Niraj you need to run git init first Commented Mar 3, 2021 at 18:09
  • Don't run this command by itself; it doesn't do what the answer is suggesting. It's missing --global (as you can see in other answers).
    – bariod
    Commented Aug 9 at 11:10
4

just Disable the Firewall and start again. it worked for me

2
  • 1
    Not. Turning off the firewall did not help. Commented Apr 4, 2019 at 10:22
  • You have to check your pod file, because your dependency can be fetched from internal repo. Sometimes this error is caused by proxy or vpn Commented Jul 10, 2019 at 8:35
3

Following steps helped me to fix this issue, Solution 1:

  1. git checkout master
  2. git pull
  3. git checkout [you current branch]
  4. git pull

You can also set git config http.postBuffer 524288000 to increase the network buffer

Solution 2:

Sometimes it happens when you are cloning your repo using VPN and it fails to verify the SSL

Try this out it may help:

git config http.sslVerify "false"

0
3

It could be an issue with your network (i.e. not an issue with any of your git configs, firewall, or any other machine settings). To confirm this, you could test the following:

  1. See if this issue persists on the same network on different machines (this was true for me).
  2. Try running the problematic git command (for me it was git pull) on a different network and see if it works. I brought my desktop over to a friend's and confirmed that the command did indeed work without any modifications. I also tested the command from my laptop on an open network nearby and the command also started suddenly working (so this was also true for me)

If you can confirm #1 and #2 above, it may be time to schedule an appointment with a technician from your ISP. I have fiber internet in a fairly newish building and when the technician arrived they went to my building's telecom room and switched my internet port. That somehow seemed to fix the issue. He also let me know that there were other issues at large going on in my building (so it could have nothing to do with your machine or things in your control!).

If that fails, maybe consider switching internet providers if that's an option for you. Else, just keep calling your ISP to send in more and more senior technicians until it gets resolved.

I'm hoping nobody actually has to resort to what I did to find the problem.

tl;dr: Give your ISP a call as the issue could be one with your network.

3

All these tips did not work for me, what worked was cloning over ssh rather than http

0
3

If you have VPN opened, close and try it again.

1
2

It's mentioned as SSL_ERROR_SYSCALL, errno 10054.

To resolve this SSL issue I went to .gitconfig file (which is located in c drive in my desktop) I changed sslverify to false and added my username and email id.

sslVerify = `false` //make sslVerify as false    
[user]
    name = `***<Enter your name>**`
    email = `**<Email Id>**`
2
2

I had the same issue and found out the problem was with my internet speed, after getting on a better connection the problem was solved solved.

2

Before cloning just run "git init". It will create local .git and it will allow for clone.

0
2

Follow these two commands from Git Bash

step1: git init

step2: git config http.postBuffer 524288000

step3: initiate the clone again.

Added image for reference

1

I had the exact same problem while trying to setup a Gitlab pipeline executed by a Docker runner installed on a Raspberry Pi 4

Using nload to follow bandwidth usage within Docker runner container while pipeline was cloning the repo i saw the network usage dropped down to a few bytes per seconds..

After a some deeper investigations i figured out that the Raspberry temperature was too high and the network card start to dysfunction above 50° Celsius.

Adding a fan to my Raspberry solved the issue.

1

In my case, its something wrong with my DNS server, after i add a new github.com record in the hosts, the problem solved.

13.114.40.48 github.com
1

This is what works for me.

git config --global http.sslVerify "false"

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 9, 2022 at 17:33
  • http.sslVerify "false" is for disabling a safety measure, which is in place to prevent MITM attacks. So, not recommended to set it to false. Technically it works, but you better take a look into how to get the verification to work again.
    – Michael
    Commented Apr 22 at 7:34
1

this issue is resolved by cloning using SSH key. first of all set the ssh key and then add it to your git/github account. and then try to clone using ssh instead of using http. in my case this solved my problem. i tried all the other solution including increasing the buffer size, changing the git version, etc. none of these solution works in my case.

0
1

I've tried postBuffer, core.compression and --depth 1, nothing is working perfectly, I mean sometimes, I could clone but most of the time, I got the same error. For me, it got worked out by cloning using SSH url. You can follow below steps to clone in ssh way

  1. create ssh key

    create .ssh folder in your user directory (C:\Users\Rence Abishek\) and inside .ssh folder, create a file named id_rsa

    Open your terminal from user dir and execute below commands to create ssh private and public key

    1. ssh-keygen -t rsa -b 4096 -C "[email protected]"

      press y to override existing file i.e id_rsa and not require to give passphrase, just hit enter

    2. eval $(ssh-agent -s)

    3. ssh-add ./.ssh/id_rsa

  2. copy ssh key to your git version control(gitlab,bitbucket,github..etc)

    Execute cat ./.ssh/id_rsa.pub command in terminal to get public key in console, now copy that and go to your GIT version control setting and add your copied public key.

Github -> click on your profile(top right cornor) -> setting -> SSH and GPG Keys -> New SSH Key button

  1. clone repo

Now clone using ssh url git clone YOUR_SSH_URL

1
  • This was the solution for me and setting postBuffer to a bigger value than any of the individual files had done naff all to help. However, on my (Windows) machine steps 1.2 and 1.3 were not needed, and in fact did not work
    – Jez
    Commented Mar 18, 2023 at 19:54
1

Adjusting (lowering) the transfer speed also helps to make the process more reliable over unstable connections.

Something like below:

git config --global http.lowSpeedLimit 1000
git config --global http.lowSpeedTime 60
0

What I did is moved the dependencies list to the end of

#Pods for <app>

In Podfile. Like this:

    # Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'

    target '<app>' do
    # Comment the next line if you don't want to use dynamic frameworks
    use_frameworks!

  # Pods for <app>

  target '<app>Tests' do
    inherit! :search_paths
    # Pods for testing
  end

  target '<app>UITests' do
    inherit! :search_paths
    # Pods for testing
  end

    pod 'Firebase/Core'
    pod 'Firebase/Database'

end
0

I too have faced this issue today. I have tried all the options shared in this thread but I was still having the issue.

I tried cloning after connecting to my corporate VPN and cloning got completed successfully. So, guys it might have to do with your local firewall policy. Factor in that as well :)

0

For me the issue was with my wifi extender. When I connect directly to my wifi without using extender, it started working.

1
  • As seen in other answers too, a poor connection could be a reason for the problem. Hence this answer remains relevant and helpful. Commented Mar 13 at 13:16
0

For me, git config --global http.postBuffer 524288000 alone did not fix it, I had to run git config --global core.compression 0 as well.

0

try this,

  1. git init first/reinitialize
  2. then, global http.postBuffer 157286400
  3. after that, just set/add ur remote like before
  4. add, commit, push. this solves mine
0

Check that you have the correct spelling and branch name. It is case sensitive. enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.