GIT 推送,HTTP 代码 = 502 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24322896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:13:42  来源:igfitidea点击:

GIT push, HTTP code = 502 error

gitgitlab

提问by Attila Naghi

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

我的项目大小是 1,63 GB(Magento 项目)我遵循了本教程

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:

当我执行此命令时 : git push -u origin master,它开始写入对象,之后我在 git 控制台中收到此错误:

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

git remote -v 的结果是: 在此处输入图片说明

回答by user1978011

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

远程端挂断是因为您尝试传输的包大小超过最大 HTTP 帖子大小。尝试限制此包大小

git config --local http.postBuffer 157286400

to 150MB.

到 150MB。

回答by Jaanus

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

回答by Yuvraj Singh Shekhawat

Try below commands.

试试下面的命令。

git config --global user.name "dummy"

git config --global user.name "dummy"

git config --global user.email "[email protected]"

git config --global user.email "[email protected]"

git config --global http.postBuffer 157286400

git 配置 --global http.postBuffer 157286400

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

更多信息:https: //confluence.atlassian.com/stashkb/error-rpc-failed-result-22-push-to-stash-fails-604537633.html

回答by AVKurov

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

就我而言,当我在root用户下的服务器上创建 git 存储库时,我遇到了相同的错误(HTTP 502 Bad gateway curl 22)。当然在这种情况下 fcgiwrap 和 git-http-backend 无法从www-data用户下的客户端接收数据。因此,在www-data用户下重新初始化服务器存储库后,错误消失了。希望它可以帮助某人。

回答by Rakesh

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
  1. 打开首选项(在 Mac 上)或设置(在 Windows 中)
  2. 单击“Git”选项卡。
  3. 找到“git 版本”。在 git version 下点击“reset to Embedded git”按钮,然后点击“Use System Git”按钮。(此设置适用于 Mac OS,如果您使用的是 Windows,请在那里找到类似的设置。)在此处输入图片说明

see image

看图片

回答by mybodycravesbutterygoodness

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.

我看到了同样的错误,但这些解决方案都没有奏效。这是一个愚蠢的错误,但我想我会添加它,以防其他人遇到它。设置远程源时,我忘记了 URL 末尾的“.git”。

回答by Khizhny Andrey

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:

当我从代理连接(通过 CNTLM)切换到直接连接时,我遇到了类似的问题。解决方案是从文件 c:\Users\.gitconfig 中的 http 部分删除这一行:

proxy = localhost:3128