当我试图逃跑的时候

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 -或ssh或curl或任何先超时的东西对这样的网络更宽容,但我不知道它是什么。

对开发商的呼吁: 这类问题对农村人口来说是一个持续的问题。当您设计系统、工具和应用程序时,请考虑我们。谢谢你!

其他回答

当我在.ssh中有不正确的keypair时,我得到这个错误。将pubkey添加到github(在设置中)为我修复了这个问题。

我收到了与fatal相同的错误消息:远程端意外挂断,没有一个答案解决了我的问题。我通常的工作流程是这样的:

本地签出基本分支(设置了远程源) 从本地的基分支构建子分支 完成我所有的编码 承诺我的东西 按它(然后控制台会告诉我,没有上游设置) 通过git push——set-upstream origin <远程分支名>来设置上游

之后,我的代码通常被推送-但在这种情况下,我有一个提交,我触摸110+文件,我得到了错误。

解决方案:

renaming the current local branch with git branch -m <branch name temp> checkout base branch (as it best at the same state where the local branch was created) creating the new child branch with the final name with git checkout -b <branch name> pushing the new child branch now without any commit, so that it is created at the remote side (also again by git push --set-upstream origin <remote branch name>) cherrypicking the commits from the <branch name temp> branch pushing the commits (after checking that I cherrypicked all commits in the right order, the first commit needs to be the first cherrypicked one)

然后就成功了。

希望这也能帮助到这里的一些人!:)

我尝试了上面的大部分选择,没有一个对我有效, 但这是可行的

Git重置origin/branch_name——force

这可能会起作用,但你会失去你的工作 您可以复制更改到git的旧或新位置。

对我来说,问题的原因是网络设置:我有一个“杀手”wifi卡,它显然会以一种SSH和SSL不喜欢的方式破坏网络数据包。

为了解决这个问题,我不得不进入“杀手控制中心”,“参数”,并禁用“高级流检测”- git命令立即重新开始工作。

对于我来说,我使用git子模块,通过以下方法解决:

git fetch 

然后在开发的分支上创建任何提交。

git push origin develop
git pull origin develop