当我试图逃跑的时候

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

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


当前回答

1) CD到项目总监

2) 进入状态

3) git checkout -f HEAD

4)确认成功下拉大师再次确保你是最新的,如果你的回购看起来不完整

如果你在从Bitbucket克隆一个repo时从Visual Studio的Git中得到错误,这是有效的

其他回答

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

git fetch 

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

git push origin develop
git pull origin develop 

如果使用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的文档错误:

远程:致命:包超过允许的最大大小

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

Git重置origin/branch_name——force

这可能会起作用,但你会失去你的工作 您可以复制更改到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)

然后就成功了。

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

以上的解决方案都不适合我,但是我要提交的任务非常大。

非常简单,我把它分成两个提交,分别推送每个提交,它立即通过。