git 为什么会出现错误:RPC failed; result=52, HTTP code = 0 fatal: 远程端推送到github时意外挂了?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18436812/
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
Why do I get error: RPC failed; result=52, HTTP code = 0 fatal: The remote end hung up unexpectedly when pushing to github?
提问by Nearpoint
I created a new repository on github
and wanted to push some files. So I initialize the repository like normal and do git add .
to add the current directory (which is my java
project folder with bin
and src
folder inside). Then I added the remote directory using:
我创建了一个新的存储库github
并想推送一些文件。所以我初始化像正常的存储库,并做git add .
以增加当前目录(这是我java
与项目文件夹bin
和src
文件夹内)。然后我使用以下方法添加了远程目录:
git remote add https://github.com/username/project.git
Then I made my first commit git commit -m "First Commit"
然后我做了我的第一次提交 git commit -m "First Commit"
then I type git push -u origin master
and I get this error:
然后我输入git push -u origin master
并收到此错误:
Counting objects: 63, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (60/60), done.
Writing objects: 100% (62/62), 16.98 KiB, done.
Total 62 (delta 15), reused 0 (delta 0)
error: RPC failed; result=52, HTTP code = 0
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date
But if I add just one file and try to commit just a single file, it works.
但是如果我只添加一个文件并尝试只提交一个文件,它就可以工作。
What is going on? Why can I not commit my whole Java project? Its a pretty small project only 214k. Please help! Thanks!
到底是怎么回事?为什么我不能提交我的整个 Java 项目?它是一个非常小的项目,只有 214k。请帮忙!谢谢!
采纳答案by Nearpoint
Now it is working! I didn't even change a thing.
现在它正在工作!我什至没有改变任何东西。
This kind of an error ' result=52 ' is an error with github itself. Github.com was going down and when I tried uploading I got the error. Now the site is back up and I can commit like normal.
这种错误 ' result=52 ' 是 github 本身的错误。Github.com 宕机了,当我尝试上传时出现错误。现在该站点已备份,我可以像往常一样提交。
回答by jjpcondor
Bitbucket has the same error message. Often it is related to degraded server performance. Before you start doing anything else, check:
Bitbucket 有相同的错误信息。通常它与服务器性能下降有关。在开始做任何其他事情之前,请检查:
回答by Dughall
This error also happens if your HTTP
post buffer is too small for the changes you want to push.
如果您的HTTP
发布缓冲区对于您要推送的更改来说太小,也会发生此错误。
In this case, the solution is to increase it, for example using
在这种情况下,解决方案是增加它,例如使用
git config http.postBuffer 524288000
回答by Ferry Boender
I ran into this problem when trying to clone/fetch from a Bitbucket repository over http. It turns out the repository is too big(+1gb) and Bitbucket replies with this error:
我在尝试通过 http 从 Bitbucket 存储库克隆/获取时遇到了这个问题。结果发现存储库太大(+1gb),Bitbucket 回复了这个错误:
error: RPC failed; result=52, HTTP code = 0
fatal: The remote end hung up unexpectedly
I switched to the SSH protocol and now it works fine. Afterwards, you can set the remote back to the http version if you need to, and it will keep working.
我切换到 SSH 协议,现在它工作正常。之后,如果需要,您可以将遥控器设置回 http 版本,它会继续工作。
回答by jossie
This could happen if you have a faulty internet connection too, Yeah I am experiencing one at this time.. :).
如果您的互联网连接也有问题,也可能会发生这种情况,是的,我此时正在经历一个.. :)。
回答by Ajay Bhasy
This can be also due to the following
这也可能是由于以下原因
Reason
原因
Prescence of large files (45MB in our case)
大文件的存在(在我们的例子中为 45MB)
Why
为什么
Large files cause HTTPS Timeout
大文件导致HTTPS超时
Solution
解决方案
Use SSH or Remove large files
使用 SSH 或删除大文件
回答by Hyman Le
回答by Nolwennig
For Bitbucket, I resolve this with switch to ssh instead of http.
对于Bitbucket,我通过切换到 ssh 而不是 http 来解决这个问题。
- Configure
SECURITY > SSH keys
inAvatar > Bitbucket settings
: - Change remote url from
https://...
togit@...
- Edit
.git/config
file ORlaunchgit remote set-url origin git@...
- Edit
git push -u origin --all
(NB:git add .
follow bygit commit -m "intial commit"
before)
- 配置
SECURITY > SSH keys
中Avatar > Bitbucket settings
: - 将远程 url 从更改
https://...
为git@...
- 编辑
.git/config
文件或启动git remote set-url origin git@...
- 编辑
git push -u origin --all
(注意:git add .
跟在git commit -m "intial commit"
前面)
based on wintersolider's answer
回答by Thomas Praxl
It took me hours. I had the same problem using https. Plus: I could not connect to bitbucket via ssh.
我花了几个小时。我在使用 https 时遇到了同样的问题。另外:我无法通过 ssh 连接到 bitbucket。
I'm using Linux Mint 17.x and this solution worked like a charm for ssh:
我正在使用 Linux Mint 17.x,这个解决方案对 ssh 来说就像一个魅力:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1254085(answer from bs – bentzy-sagiv)
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1254085(来自 bs 的回答 – betzy-sagiv)
This solved the issue:
Append to /etc/sysctl.conf the following: net.ipv4.tcp_mtu_probing = 1
after restart you should see at /proc/sys/net/ipv4/tcp_mtu_probing the value "1"
A temporary solution is: echo 1 > /proc/sys/net/ipv4/tcp_mtu_probing caveat: this will be reset at boot.
You can try also with value "2" if still not working.
(see explanation at:https://thesimplecomputer.info/pages/adventures-in-linux-tcp-tuning-page2)
这解决了这个问题:
将以下内容附加到 /etc/sysctl.conf:net.ipv4.tcp_mtu_probing = 1
重新启动后,您应该在 /proc/sys/net/ipv4/tcp_mtu_probing 看到值“1”
临时解决方案是: echo 1 > /proc/sys/net/ipv4/tcp_mtu_probing 警告:这将在启动时重置。
如果仍然无法正常工作,您也可以尝试使用值“2”。
(见解释:https: //thesimplecomputer.info/pages/adventures-in-linux-tcp-tuning-page2)