30

My project size is 1,63 GB (Magento Project) I had followed this tutorial

when I do this command : git push -u origin master , it is starting to write objects and after that I getting this error in git console:

error: RPC failed, result=22, HTTP code = 502
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

What should I do to make this work ?

The result of the git remote -v is : enter image description here

Kara
  • 6,115
  • 16
  • 50
  • 57
Attila Naghi
  • 2,535
  • 6
  • 37
  • 59
  • How is the git repository hosted? Locally, GitHub, GitLab...? Do you host it yourself, or use some hosting provider? Is there a proxy in front of the repository server? – sleske Jun 20 '14 at 08:25
  • 1
    And incidentally, a repo size of >1GB is pushing git's limits. Consider using something like [git-annex](https://git-annex.branchable.com/). – sleske Jun 20 '14 at 08:26
  • 1
    @sleske I m using a hosting provider – Attila Naghi Jun 20 '14 at 08:26
  • @Chester: And which one would that be? And with which access method? – sleske Jun 20 '14 at 08:28
  • i have to install git-annex ? it will work 100% ? – Attila Naghi Jun 20 '14 at 08:28
  • @Chester: You don't have to, but it will avoid some problems. However, you will need some extra setup (and a separate provider for file storage). If you are interested, read up on git-annex, then if you still have a question, ask it separately. – sleske Jun 20 '14 at 08:30
  • 1
    @Chester: 502 is "Bad gateway". It usually means that the web server (nginx, Apache...) in front of the actual service is telling you that that service is not running - not accepting requests. Usually it cannot start due to configuration error, wrong configuration, missing dependencies... We need to know more details to what are you actually connecting. What does `git remote -v` print out? – Messa Jun 20 '14 at 11:31
  • @Messa I updated my post , please check it out – Attila Naghi Jun 25 '14 at 11:48
  • Is it possible to use SSH instead of HTTP? The URL should be then `ssh://netlogiq@gitlab.netlogiq.eu:2112/attin/test.git`. I've found some info about problems with pushing large commits (or possibly large amount of commits?) to Gitlab, for example https://github.com/gitlabhq/gitlabhq/issues/3882 or http://stackoverflow.com/questions/17826660/gitlab-git-clone-https-with-large-repos-fails – Messa Jun 25 '14 at 13:27
  • @Messa I certanly sure that I used HTTP :) – Attila Naghi Jun 25 '14 at 13:42
  • It doesn't matter whether HTTP or HTTPS. The problem is that it has to go through web server, which adds another layer of timeouts and max size limits. – Messa Jun 25 '14 at 14:00
  • Does your project need to be that large? Are you storing videos in the repository? Of course you can use it however you want, but it will be a lot less painful if your are only managing source code and not binary files. There are ways to find large blogs in your repository and remove them. – theherk Apr 30 '15 at 00:30
  • https://confluence.atlassian.com/display/STASHKB/error%3A+RPC+failed+result%3D22+-+Push+to+Stash+fails check this out, it can be useful – vcmkrtchyan Apr 30 '15 at 22:11

10 Answers10

41

The remote end hangs up because the pack size you are trying to transmit exceeds the maximum HTTP post size. Try to limit this pack size with

git config --local http.postBuffer 157286400

to 150MB.

user1978011
  • 3,419
  • 25
  • 38
10

I got this problem when I had proxy set, but actually did not need proxy.

To fix:

git config --global --unset http.proxy
git config --global --unset https.proxy
Jaanus
  • 16,161
  • 49
  • 147
  • 202
4

Try below commands.

git config --global user.name "dummy"

git config --global user.email "dummy@g.com"

git config --global http.postBuffer 157286400

for more information : https://confluence.atlassian.com/stashkb/error-rpc-failed-result-22-push-to-stash-fails-604537633.html

4

I faced similar issue after I added HTTP_PROXY and HTTPS_PROXY environment variables to make other things work. I was unable to use our internal git repos. There is a way to fix it to fix it: You can add proxy variables with empty values to git using git config --global --edit:

[http]
    proxy = 
[https]
    proxy = 

Or using commands:

git config --global --add http.proxy ""
git config --global --add https.proxy ""
DJ-Glock
  • 1,277
  • 2
  • 12
  • 39
2

first increase size

# git config --global http.postBuffer 1048576000                                   
git config --global http.postBuffer 500M
git config --global http.maxRequestBuffer 100M
git config --global core.compression 0

to check size

git config --get http.postBuffer

then open server terminal

su
nano /etc/gitlab/gitlab.rb 

#edit this line
unicorn['worker_timeout'] = '4000'

#running
gitlab-ctl reconfigure

#for any case restart machine

Pit
  • 395
  • 2
  • 11
1

I had similar problem when I switched from proxy connection (via CNTLM) to direct. The solution is to remove this line from http section in file c:\Users\.gitconfig:

proxy = localhost:3128
Khizhny Andrey
  • 161
  • 1
  • 5
1

In my case I got the same error (HTTP 502 Bad gateway curl 22) when I created a git repository on a server under root user. Of course in this situation fcgiwrap and git-http-backend couldn't receive data from a client under www-data user. So after re-initialization of a server repository under www-data user the error is gone. Hope it helps someone.

AVKurov
  • 156
  • 1
  • 2
  • 6
1

I was seeing the same error and none of these solutions worked. It was a stupid mistake but I thought I would add it in case anyone else runs into it. I forgot the ".git" on the end of the URL when setting the remote origin.

0

if you are experiencing this issue on source tree , then do the following :

  1. Open preferences ( on Mac ) or settings ( in windows )
  2. click on 'Git' tab.
  3. Find "git version". under git version click on 'reset to Embedded git' button and then click back on 'Use System Git' button. ( this setting is for Mac OS , if you are using windows , find something similar there. ) enter image description here

see image

YogiAR
  • 2,207
  • 23
  • 44
0

My HTTP_PROXY and HTTPS_PROXY were setup in environment variable(s) for one project. So, removing this from environment variable(s) helped me sort the issue.

Adriaan
  • 17,741
  • 7
  • 42
  • 75