当我试图逃跑的时候

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

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


当前回答

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

其他回答

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

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

您可能在现有的存储库中克隆了存储库,要解决这个问题,可以简单地在另一个目录中克隆存储库,并将更改复制到这个新目录,然后运行推送。

对我们来说,问题是我们有大量的文件应该由git lfs来管理。

我们采取了以下措施来解决问题:

# Soft reset so you can author a new commit
git reset --soft HEAD~1

# Install git lfs
git lfs install

# Track large files of a specified file type YMMV
git lfs track "*.uasset" "*.umap"

# Re-add everything
git add .

# Author a new commit
git commit -m "git lfs ftw"

# Push
git push

基于您正在使用的推送到回购的协议

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

在我们的案例中,问题是一个克隆程序编写了一个.git/config文件,其中包含一个url条目,该url条目是一个只读访问方法。将url从://方法更改为@方法解决了这个问题。

运行git remote -v可以解释这个问题。