Git ошибка 502

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's user avatar

Kara

6,08516 gold badges49 silver badges57 bronze badges

asked Jun 20, 2014 at 8:19

Attila Naghi's user avatar

Attila NaghiAttila Naghi

2,5156 gold badges35 silver badges58 bronze badges

13

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.

answered May 1, 2015 at 5:59

user1978011's user avatar

1

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

answered Jan 5, 2016 at 13:39

Jaanus's user avatar

JaanusJaanus

16.1k49 gold badges147 silver badges202 bronze badges

0

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 are a couple of ways 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 ""

answered Dec 16, 2021 at 7:53

DJ-Glock's user avatar

DJ-GlockDJ-Glock

1,2632 gold badges12 silver badges36 bronze badges

0

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

answered Apr 27, 2016 at 23:55

Khizhny Andrey's user avatar

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.

answered May 17, 2017 at 5:05

AVKurov's user avatar

AVKurovAVKurov

1561 gold badge2 silver badges6 bronze badges

2

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.

answered Dec 13, 2019 at 18:52

mybodycravesbutterygoodness's user avatar

1

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

answered Jan 11, 2021 at 21:20

Pit's user avatar

PitPit

3652 silver badges11 bronze badges

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

answered Oct 11, 2018 at 18:57

YogiAR's user avatar

YogiARYogiAR

2,20923 silver badges44 bronze badges

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's user avatar

Adriaan

17.7k7 gold badges40 silver badges75 bronze badges

answered Jan 19 at 9:45

mitesh keswani's user avatar

The error «The requested URL returned error 502» is a common issue faced by users when using Git in a corporate environment. This error occurs when the Git client is unable to access the requested URL due to network restrictions, firewalls, or incorrect proxy configurations. In such cases, users might be unable to clone, fetch, or push changes to remote repositories. To resolve this error, there are several methods that can be tried, including updating the Git configuration, troubleshooting proxy settings, and bypassing firewalls.

Method 1: Updating Git Configuration

To fix the error «The requested URL returned error 502» in Git, you can try updating Git configuration by following these steps:

  1. Open Git Bash or your terminal and type the following command to check the current Git configuration:

  2. Look for the «http.proxy» setting. If it is set to a proxy server, you need to update it to your corporate proxy server. Type the following command to update the proxy setting:

    git config --global http.proxy http://corporate-proxy-server:port

    Replace «corporate-proxy-server» and «port» with your corporate proxy server and port number.

  3. If your corporate proxy requires authentication, you need to add your username and password to the Git configuration. Type the following command to add your username:

    git config --global http.proxyUsername your-username

    Replace «your-username» with your actual username.

  4. Type the following command to add your password:

    git config --global http.proxyPassword your-password

    Replace «your-password» with your actual password.

  5. Finally, type the following command to verify the updated Git configuration:

    Look for the «http.proxy» setting and make sure it is set to your corporate proxy server.

With these steps, you should be able to fix the error «The requested URL returned error 502» in Git by updating Git configuration.

Method 2: Troubleshooting Proxy Settings

To troubleshoot proxy settings in Git, follow these steps:

  1. Check if the proxy settings are configured correctly by running the following command in the terminal:

    git config --global http.proxy

    If the output is empty, it means that Git is not using a proxy. If there is a proxy URL, note it down for later use.

  2. If the proxy URL is not set, you can set it using the following command:

    git config --global http.proxy http://proxy-url:port

    Replace proxy-url and port with the URL and port number of your proxy server.

  3. If the proxy URL is set correctly, try disabling SSL verification by running the following command:

    git config --global http.sslVerify false

    This will bypass SSL verification and may resolve the 502 error.

  4. If the above steps do not work, try setting the http.postBuffer to a higher value by running the following command:

    git config --global http.postBuffer 524288000

    This will increase the buffer size and may help resolve the error.

  5. If none of the above steps work, try setting the http.version to HTTP/1.1 by running the following command:

    git config --global http.version HTTP/1.1

    This will force Git to use HTTP/1.1 instead of the default HTTP/1.0 and may help resolve the error.

By following these steps, you should be able to troubleshoot proxy settings and resolve the 502 error in Git.

Method 3: Bypassing Firewalls

If you are facing the error «Git: how to fix The requested URL returned error 502, corporate?» while trying to push or pull code from a Git repository behind a corporate firewall, you can try bypassing the firewall by using a proxy server. Here’s how you can do it:

  1. Set up a proxy server: You can use a free proxy server or set up your own proxy server. For example, you can use the following command to set up a SOCKS proxy server using SSH:

    ssh -D 8080 user@proxy-server

    This will create a local SOCKS proxy server listening on port 8080 that forwards all traffic through the proxy server.

  2. Configure Git to use the proxy server: You can configure Git to use the proxy server by setting the http.proxy and https.proxy Git configuration variables. For example, you can use the following commands to configure Git to use the SOCKS proxy server:

    git config --global http.proxy socks5://localhost:8080
    git config --global https.proxy socks5://localhost:8080

    This will configure Git to use the SOCKS proxy server running on localhost port 8080 for both HTTP and HTTPS connections.

  3. Test the Git connection: You can test the Git connection by running the following command:

    git ls-remote https://github.com/username/repo.git

    This will list the remote Git references for the repository username/repo.git on GitHub. If the command succeeds, you should be able to push and pull code from the repository without getting the error «Git: how to fix The requested URL returned error 502, corporate?».

That’s it! By using a proxy server, you can bypass the corporate firewall and access Git repositories that are otherwise blocked.

Method 4: Switching to SSH Instead of HTTPS

To fix the error «The requested URL returned error 502, corporate» in Git, you can switch to using SSH instead of HTTPS. Here are the steps to do so:

  1. Generate an SSH key pair if you haven’t already done so. You can do this using the following command:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  1. Add your public SSH key to your Git account. You can copy the contents of your public key file (usually ~/.ssh/id_rsa.pub) and paste it into your Git account settings.

  2. Update your Git remote URLs to use SSH instead of HTTPS. You can do this using the following command:

git remote set-url origin git@github.com:username/repo.git

Replace username with your Git username and repo with the name of your repository.

  1. Test your SSH connection by running the following command:

You should see a message that says «Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.»

That’s it! You should now be able to push and pull from your Git repository using SSH instead of HTTPS.

Note: If you’re using a different Git hosting service, the steps may be slightly different. Check their documentation for more information.

Solution 1

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.

Solution 2

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

Solution 3

Try below commands.

git config —global user.name «dummy»

git config —global user.email «[email protected]»

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

Solution 4

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

Solution 5

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.

Related videos on Youtube

HOW TO FIX: error: failed to push some refs to  | Create Remote GitHub Repository in 2 Minutes

02 : 33

HOW TO FIX: error: failed to push some refs to | Create Remote GitHub Repository in 2 Minutes

Cách sử dụng GitHub - Push File lên GitHub và Fix một số lỗi

07 : 52

Cách sử dụng GitHub — Push File lên GitHub và Fix một số lỗi

[FIXED] Error 502 Bad Gateway Error Problem (100% Working)

05 : 57

[FIXED] Error 502 Bad Gateway Error Problem (100% Working)

Git Error | GitHub Error: failed to push some refs to '[REPO URL]'

03 : 59

Git Error | GitHub Error: failed to push some refs to ‘[REPO URL]’

HOW TO: Fix git fatal: Authentication failed (Windows Git Bash)

01 : 20

HOW TO: Fix git fatal: Authentication failed (Windows Git Bash)

How to solve 502 error for Git Backup

17 : 00

How to solve 502 error for Git Backup

Pleasurable Learning SuperMemo

GIT  : Resolving " Code push Rejected "

08 : 10

GIT : Resolving » Code push Rejected «

How To Fix GitHub Push Rejected Errors + Explanation

02 : 25

How To Fix GitHub Push Rejected Errors + Explanation

LearnToCode — الدارجة المغربية

Comments

  • 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

    • And incidentally, a repo size of >1GB is pushing git’s limits. Consider using something like git-annex.

    • @sleske I m using a hosting provider

    • @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?

  • I think this is my problem but I don’t see or don’t know how to find this user. Could you supply the steps that you did so that I can try to see if this helps me?

  • Worked for me!.Needed to add «.git» to config file under the [remote «origin»] url section

  • Thank you! sudo chown -R www-data.www-data . on the server fixed the problem.

Recents

Related

GitLab Forum

Loading

Solution by iamchanghyunpark

“I checked the pid value in the log and checked if there was a running process with the same pid, and no there was none.
I’m guessing this is because of the unexpected powerdown, and unicorn.pid was not properly cleared.
My solution was simple”

docker-compose exec gitlab bash
vi log/unicorn.stderr.log # remove the value (which is the pid), save and exit
exit # from the bash shell of the gitlab container

#Now restart the containers
docker-compose down
docker-compose up -d

Share on:

Понравилась статья? Поделить с друзьями:
  • Git pull ошибка
  • Git commit ошибка
  • Git clone ошибка авторизации
  • Git add ошибка
  • Gisoms ffoms gov ru ошибка 404