21

git push fails with following error

fatal: RPC failed: curl 52: Empty reply from server

The upload succeeds in case only one file was modified, added or deleted.

The following settings to don't work reliably

 git config --global --add core.compression -1

The git version is 2.8.2 running on ubuntu 14.04, and I have tried with both openssl and gnutls compilations.

ssh remotes also fail.

The problem is encountered with repositories of

bitbucket
github
gitlab

Fail safe answers appreciated

Tal Avissar
  • 10,088
  • 6
  • 45
  • 70
sulimo
  • 279
  • 1
  • 2
  • 6

7 Answers7

17

In terminal use sudo to clone, or type:

git config --global http.postBuffer 157286400

its worked for me

Learn Swift
  • 570
  • 5
  • 15
Eduardo Oliveros
  • 863
  • 9
  • 20
16

Following worked for me.

git config --global core.compression 0

git clone --depth 1 <repo> //  partial clone to truncate the amount of info coming down

#cd repo // go into the new directory and 

git fetch --unshallow //retrieve the rest of the clone

git pull --all //final pull

Hope, this could be helpful for someone having the same issue.

f-society
  • 2,898
  • 27
  • 18
7

I had a chat with Gideon @ atlassian he suggested to use SSH over HTTPS to fix the "curl 52" error.

For me switching to SSH fixed the problem. Here's the complete answer:

This is a HTTP/HTTPS timeout issue involving either some large commit size, or a weak network. If you're cloning, can you try to see if you can clone the repository using this method:

https://stackoverflow.com/a/22317479

Can you try to see if running this command before any git operations help as well:

git config --global http.postBuffer 524288000

Also, this issue usually won't occur in SSH; so maybe it is worth trying to set up SSH and then do the operation through SSH:

https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html

Community
  • 1
  • 1
Dado
  • 1,147
  • 1
  • 13
  • 31
  • Thanks, it works. I found the way to switch to SSH at: https://help.github.com/articles/changing-a-remote-s-url/#switching-remote-urls-from-https-to-ssh – Zing Lee Dec 06 '16 at 07:10
1

Following worked for me. stop WIFI and use the Network cable to connect the NetWork

Maybe it is a problem about network

  • I had the same issue. Your statement about the problem with the network was right. But I had vice-versa: I stopped LAN connection and started Wi-Fi, it resolved the issue. Many thanks! – Anuar Maratkhan Jun 09 '19 at 12:16
0

I have the same problem on arch linux, git version 2.8.2, can't push to bitbucket repo. Cloning and pull works.

Usern4me
  • 127
  • 2
  • @Dado: Sorry for commenting here, I can't comment your answer yet. I tried earlier with changing postBuffer size, but it didn't work, I have a good internet connection and, and I modified only 4 not too big files (few hundred lines c++ code ~50 lines changed all in all). I nevertheless tried ssh, but it also fails with: `fatal: The remote end hung up unexpectedly` – Usern4me May 09 '16 at 15:31
  • Interesting I had problems pulling instead ;) Try to open a ticket with them they are quite good with customer service. (the only thing I can think of is just make sure that you aren't accidentally still using HTTPS) – Dado May 10 '16 at 15:12
0

Appearently it's a problem with HTTPS problem. Switching to SSH fix the problem with all repositories.

Fares Benhamouda
  • 589
  • 8
  • 21
0

This happened in my case during a push and it was seemingly due to duplicate consecutive commit messages. Once I amended (git commit --amend) the second message to be slightly different from the first, pushed again, and success.