当我试图逃跑的时候
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
这和缺乏安全感有关吗?我尝试创建一个公钥作为致命的答案:远程端意外挂断并重新运行它,但它仍然不工作。我不是在用钥匙吗?如果是,我该如何使用它?
添加一个答案似乎是毫无意义的,但是当我最终发现它是Visual Studio Online正在遭受零星的停机时,我一直在努力解决这个问题。当VS不断提示积分时,这一点变得很明显,VSO网站有时会给出500分。
Counting objects: 138816, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (38049/38049), done.
error: unable to rewind rpc post data - try increasing http.postBuffer
error: RPC failed; curl 56 SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
The remote end hung up unexpectedly/138816), 33.30 MiB | 3.00 KiB/s
Writing objects: 100% (138816/138816), 50.21 MiB | 3.00 KiB/s, done.
Total 138816 (delta 100197), reused 134574 (delta 96515)
fatal: The remote end hung up unexpectedly
Everything up-to-date
后来我把我的HTTP帖子缓冲区设置回2 MB,因为我认为它对许多较小的帖子工作得更好。
如果您推送的任何提交都是畸形的,也会发生这种情况。
我(不知不觉中)提交了一个畸形的作者电子邮件字段,但我得到的只是这个模糊的远程挂断错误消息。我能够推送其他分支,而不是这个分支,所以我开始推送来自“坏”分支的提交,直到我最终降落在:
Pushing to git@github.com:directangular/unicorn.git
Counting objects: 100% (9/9), done.
Delta compression using up to 20 threads
Writing objects: 100% (5/5), 549 bytes | 549.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: error: object 74c7584ff0b93591c19d3a3c19695889dd2274d2: badEmail: invalid author/committer line - bad email
remote: fatal: fsck error in packed object
error: remote unpack failed: index-pack abnormal exit
To github.com:directangular/unicorn.git
! [remote rejected] pizzafeast -> pizzafeast (failed)
error: failed to push some refs to 'git@github.com:directangular/unicorn.git'
因此,看起来远程端意外挂起的错误有点像“吞下”实际的错误消息,这可能是我在这里看到的某种畸形提交。
在修复了错误的电子邮件后,我能够很好地推动。
罪魁祸首(就我而言):
高时延网络。
这本身不是一个答案,而更多的是一种观察,可以帮助其他人。我发现这个错误偶尔会在高延迟网络上弹出(例如,我必须使用卫星天线上网)。网络的速度很好,但延迟可能很高。注意:问题只存在于某些场景,但我还没有确定是什么模式。
临时缓解:
我换了网络——我换到了一个更慢,但延迟更低的蜂窝网络(我的手机用作热点)——问题消失了。请注意,我只能周期性地这样做,因为我的手机连接也是间歇性的。再加上带宽的使用增加了成本。我也很幸运,我有这样的选择。不是每个人都这样。
我确信在某个地方有一些配置设置使git -或ssh或curl或任何先超时的东西对这样的网络更宽容,但我不知道它是什么。
对开发商的呼吁:
这类问题对农村人口来说是一个持续的问题。当您设计系统、工具和应用程序时,请考虑我们。谢谢你!
在我的情况下,我得到了这个错误,当推动与Intellij Idea。
以下是我如何追踪我的错误并修复它。
在终端中启用调试日志记录,这从来都不是一个坏主意:)
set GIT_CURL_VERBOSE=1 set GIT_TRACE=1
通过终端推送,而不是通过intellij推送
git push
-> fatal: The current branch feature/my-new-feature has no upstream branch.
To push the current branch and set the remote as upstream
解决方案是设置上游,这一定是之前出了问题:
git push --set-upstream origin feature/my-new-feature
基于您正在使用的推送到回购的协议
HTTP
git config --global http.postBuffer 157286400
引用:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-httppostBuffer
SSH
在~/中添加以下内容。Linux机器中的Ssh /config文件
Host your-gitlab-server.com
ServerAliveInterval 60
ServerAliveCountMax 5
IPQoS throughput
引用:
https://docs.gitlab.com/ee/topics/git/troubleshooting_git.html#check-your-ssh-configuration
https://unix.stackexchange.com/questions/3026/what-options-serveraliveinterval-and-clientaliveinterval-in-sshd-config-exac
https://communities.vmware.com/message/2778248
如果使用GitHub,在repo目录下,运行此命令设置http。postBuffer似乎是它的最大允许值GitHub:
git config http.postBuffer 2147483648
如果使用git clone克隆一个repo,可以使用相同的选项克隆它:
git clone -c http.postBuffer=2147483648 git@github.com:myuser/myrepo.git /path/to/myrepo
在这两种情况下,上述数字都相当于2 GiB。然而,您可能需要达到这个数量的空闲内存才能使用这个值。
确保每次推送到GitHub都提交不超过这个大小的更改。事实上,为了安全起见,我会将提交推的大小保持在1.8 GiB以下。这可能需要将一个较大的提交划分为较小的提交和推送。
为什么是这个值?
之所以使用这个特定的值,是因为至少在2018年,这个值被记录为GitHub的推送大小限制:
我们不允许超过2GB的推送
为什么不放低一点呢?
一些先前的答案说将其设置为524288000 (500 MiB),但这个数字似乎是任意的,没有价值。任何较低的值都可以工作,只要您的推送大小不大于设置的值。
为什么不设高一点呢?
如果你将这个值设置为高于2 GiB,并且如果你尝试的推送大小也更高,你可以期待GitHub的文档错误:
远程:致命:包超过允许的最大大小
最近我也遇到了同样的问题。当克隆远程存储库时,我得到了如下错误:
fatal:对端异常挂机。MiB | 7.00 KiB/s
致命:早期EOF
index-pack失败
当我用谷歌搜索这个错误时,我被重定向到这里。我回答了大部分问题,但没有解决我的问题。
唯一的解决办法是重新安装我的“网络适配器(WiFi)驱动软件”。所以,我想强调的是,上述错误也可能是由你电脑的WiFi驱动软件的问题造成的。如果上述答案都不工作,那么您可以尝试重新安装WiFi驱动程序。这将解决问题。
您可以轻松地重新安装WiFi驱动程序,如下所示:
打开网络和互联网设置
选择“网络重置”
然后选择“立即重置”
重启电脑后,尝试git操作成功(推/拉/克隆)。
我收到了与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)
然后就成功了。
希望这也能帮助到这里的一些人!:)