git RPC 失败;结果=28,HTTP代码=0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7700824/
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-19 06:04:01  来源:igfitidea点击:

RPC failed; result=28, HTTP code = 0

gitgithub

提问by Petra Barus

I'm trying to push my code into github, but almost everytime I meet this error

我试图将我的代码推送到 github,但几乎每次我遇到这个错误

error: RPC failed; result=28, HTTP code = 0
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

It's so annoying. Anyone knows how to fix this?

这太烦人了。有谁知道如何解决这个问题?

UpdateAfter I googled, I read that running git config --global http.postBuffer 524288000could solve the problem. But even after I ran that command, I still met the problem.

更新谷歌搜索后,我读到运行git config --global http.postBuffer 524288000可以解决问题。但是即使在我运行该命令之后,我仍然遇到了问题。

回答by Lazy Badger

Use git:// or git+ssh://, not https

使用 git:// 或 git+ssh://,而不是 https

回答by Abhijith Sasikumar

It is not necessary to use SSH here as mentioned in the accepted answer. Recently got stuck with the same issue. Increase the Http default 1 MiB buffer size to a large value:

如已接受的答案中所述,没有必要在此处使用 SSH。最近遇到了同样的问题。将 Http 默认的 1 MiB 缓冲区大小增加到一个较大的值:

git config --global http.postBuffer 1048576000

then try git push remote branch_name.

然后尝试git push remote branch_name

Hope it helps somebody.

希望它可以帮助某人。

回答by u445908

I met the same problem( working behind a proxy and not able to access git://)

我遇到了同样的问题(在代理后面工作并且无法访问 git://)

maybe it depends on the network situation?

也许这取决于网络情况?

do the "push" more times and it works for me. (pushed total 5 times, 2 successful)

多做几次“推”,它对我有用。(总共推送5次,成功2次)

btw, I am using the "https_proxy" environment variable, not the "http_proxy"

顺便说一句,我使用的是“https_proxy”环境变量,而不是“http_proxy”

回答by andygavin

That error code is a timeout error on the client. Although I suspect that the server-side is closing as the message suggests. To try and get more information you could try setting the environment variable GIT_CURL_VERBOSE=1for your push eg:

该错误代码是客户端上的超时错误。虽然我怀疑服务器端正在按照消息所暗示的那样关闭。要尝试获取更多信息,您可以尝试GIT_CURL_VERBOSE=1为推送设置环境变量,例如:

GIT_CURL_VERBOSE=1 git push origin

GIT_CURL_VERBOSE=1 git push origin

This can give you an indication of whether it is the client timing out or the server disconnecting that is the original error. There are a number of things you might do to ensure that you're not always coming across this error.

这可以让您指示是客户端超时还是服务器断开连接才是原始错误。您可以采取多种措施来确保不会总是遇到此错误。

  1. Check the timeouts on the server side, if you can control it. They may be too small. This depends on the server implementation.
  2. Check your repository for large files particularly binary files. These can be handled differently.
  3. Ensure you aren't setting http.lowSpeedLimit, http.lowSpeedTime inadvertently: they should be off by default (by looking at the code).
  1. 如果您可以控制它,请检查服务器端的超时。它们可能太小了。这取决于服务器实现。
  2. 检查您的存储库中的大文件,尤其是二进制文件。这些可以不同地处理。
  3. 确保您没有无意中设置 http.lowSpeedLimit、http.lowSpeedTime:默认情况下它们应该是关闭的(通过查看代码)。

Large Repository

大型存储库

For point 2. There are a number of things you can do if you suspect that the pack you are pushing is large objects. This blog post is quite detailed on the subject:

对于第 2 点。如果您怀疑要推送的包裹是大型物体,您可以采取多种措施。这篇博文对这个主题非常详细:

http://blogs.atlassian.com/2014/05/handle-big-repositories-git/

http://blogs.atlassian.com/2014/05/handle-big-repositories-git/

I don't think the http.postBuffer is really a solution here.

我不认为 http.postBuffer 在这里真的是一个解决方案。

回答by larrytech

Generally these error conditions and codes are due to a network misconfiguration or unreliable internet connectivity at the moment. Usually after a few tries, everything should be back to normal. Try different connection protocols if problem persists after several tries.

通常,这些错误条件和代码是由于网络配置错误或目前不可靠的互联网连接造成的。通常经过几次尝试后,一切都应该恢复正常。如果多次尝试后问题仍然存在,请尝试不同的连接协议。