当我试图逃跑的时候

git push origin master --force

我刚刚

Counting objects: 2649, done.
Delta compression uses up to 2 threads.
Compressing objects: 100% (1280/1280), done.
error: RPC failed; result=22, HTTP code = 413 | 116 KiB/s   
fatal: The remote end hung up unexpectedly
Writing objects: 100% (2504/2504), 449.61 MiB | 4.19 MiB/s, done.
Total 2504 (delta 1309), reused 2242 (delta 1216)
fatal: The remote end hung up unexpectedly
Everything up-to-date

这和缺乏安全感有关吗?我尝试创建一个公钥作为致命的答案:远程端意外挂断并重新运行它,但它仍然不工作。我不是在用钥匙吗?如果是,我该如何使用它?


当前回答

这篇文章有很好的解释,它解决了我的问题。

git config --global http.postBuffer 157286400

https://confluence.atlassian.com/stashkb/git-push-fails-fatal-the-remote-end-hung-up-unexpectedly-282988530.html

其他回答

这似乎是千百种情况中的一种。

对我来说,我最初是通过SourceTree推动master和develop (master没有变化)。将其改为开发只起了作用。

在我的案例中,这个错误是因为VPN连接中断。只需关闭和打开VPN就可以修复这个错误。

如果您正在使用windows版本的git(如果您在windows机器上执行此操作,则很可能是这样),并且这里的其他修复都不适合您,请尝试访问https://github.com/git-for-windows/git/releases,获取2.4.5版本或之后的版本。帮我搞定了。

这篇文章有很好的解释,它解决了我的问题。

git config --global http.postBuffer 157286400

https://confluence.atlassian.com/stashkb/git-push-fails-fatal-the-remote-end-hung-up-unexpectedly-282988530.html

这看起来类似于我如何让github默认为ssh,而不是https的新存储库。 也许从http协议切换到ssh协议是值得的:

$ git remote add origin git@github.com:username/project.git