当我试图跑
git push origin master --force
Run Code Online (Sandbox Code Playgroud)
我刚得到
Counting objects: 2649, done.
Delta compression using 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
Run Code Online (Sandbox Code Playgroud)
这与不安全有关吗?我尝试在Fatal的答案中创建一个公钥:远程端意外挂断并再次运行它,但它仍然无法正常工作.我实际上没有使用钥匙吗?如果是这样,我该如何使用它?
Rom*_*n M 485
问题是由于git/https缓冲区设置.为了解决它(在将提交提交到github时取自Git失败)
git config http.postBuffer 524288000
Run Code Online (Sandbox Code Playgroud)
然后再次运行命令
Vit*_*uss 73
这看起来类似于如何让github默认为ssh而不是https用于新的存储库.可能值得尝试从http协议切换到ssh:
$ git remote add origin git@github.com:username/project.git
Run Code Online (Sandbox Code Playgroud)
小智 73
原因:已超出Git的默认文件发布大小.
方案:
导航到repo.
导航到存储库后,运行以下命令将缓冲区增加到500MB:
git config http.postBuffer 524288000
Run Code Online (Sandbox Code Playgroud)
nik*_*mac 27
你可能会收到这样的错误
错误:无法锁定配置文件.git/config:没有这样的文件或目录
那是因为你没有本地.git/config文件你可以通过这个命令使它工作
git config --global http.postBuffer 524288000
小智 23
罪魁祸首(就我而言):
高延迟网络。
这本身并不是一个答案,而是更多的观察结果,可以帮助其他人。我发现这个错误偶尔会在高延迟网络上弹出(例如,我必须使用卫星天线来访问互联网)。网络速度很好,但延迟可能很高。注意:问题只存在于某些场景,但我还没有确定是什么模式。
临时缓解措施:
我切换了网络——我转向了速度较慢但延迟较低的蜂窝网络(我的手机用作热点)——问题消失了。请注意,我只能间歇性地执行此操作,因为我的单元连接也是间歇性的。此外,带宽使用会增加成本。我也很幸运,我可以使用这个选项。不是每个人都这样。
我确信某处有一些配置设置可以让 git——或 ssh 或 curl 或任何先超时的东西——更能容忍这样的网络,但我不知道它是什么。
对开发商的恳求:
这类问题是农村人口一直存在的问题。当您设计系统、工具和应用程序时,请考虑我们。谢谢你。
Md *_*man 16
以下命令可能会帮助您...
git config --global http.postBuffer 1048576000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
Run Code Online (Sandbox Code Playgroud)
小智 12
其他解决方案在我的情况下不起作用,做垃圾收集为我修复它:
git gc --aggressive
基于你用来推送到你的仓库的协议
HTTP
git config --global http.postBuffer 157286400
Run Code Online (Sandbox Code Playgroud)
参考:
SSH
~/.ssh/config在你的linux机器的文件中添加以下内容
Host your-gitlab-server.com
ServerAliveInterval 60
ServerAliveCountMax 5
IPQoS throughput
Run Code Online (Sandbox Code Playgroud)
参考:
如果使用 GitHub,则在 repo 的目录中,运行此命令http.postBuffer以将其设置为 GitHub 的最大允许值:
git config http.postBuffer 2147483648
Run Code Online (Sandbox Code Playgroud)
如果克隆 repo 而不是使用git clone,则可以使用相同的选项克隆它:
git clone -c http.postBuffer=2147483648 git@github.com:myuser/myrepo.git /path/to/myrepo
Run Code Online (Sandbox Code Playgroud)
在这两种情况下,上面的数字都相当于2 GiB。但是,您可能需要达到此数量的可用内存才能使用此值。
确保每次推送到 GitHub 的提交都不会添加超过此大小的更改。事实上,为了安全起见,我会将提交推送大小保持在 1.8 GiB 以下。这可能需要将大型提交划分为较小的提交和推送。
使用此特定值是因为至少在 2018 年,此值已记录 (存档链接)作为 GitHub 的推送大小限制:
我们不允许推送超过 2GB
一些先前的答案说将其设置为 524288000 (500 MiB),但这个数字似乎是任意的,没有价值。只要您的推送大小不大于设置值,任何较低的值都应该有效。
相反,如果您将该值设置为高于 2 GiB,并且如果您尝试的推送大小也更高,您可以预期 GitHub 记录的错误:
远程:致命:包超出最大允许大小
小智 7
这篇文章有很好的解释,它解决了我的问题。
git config --global http.postBuffer 157286400
Run Code Online (Sandbox Code Playgroud)
与其他答案之一相反-我在使用ssh进行推送时遇到了问题-我切换至https,并且此问题已修复。
git remote remove origin
git remote add origin https://github..com/user/repo
git push --set-upstream origin master
Run Code Online (Sandbox Code Playgroud)
就我而言,我在使用 Intellij Idea 推送时遇到了此错误。
以下是我如何追踪我的错误并修复它。
set GIT_CURL_VERBOSE=1 set GIT_TRACE=1
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
解决办法是设置upstream,之前肯定是出了问题:
git push --set-upstream origin feature/my-new-feature
Run Code Online (Sandbox Code Playgroud)
小智 5
在我们的例子中,问题是一个克隆写入了一个.git/config文件,其中包含一个只读访问方法的 url 条目。将 url 从://方法更改为@方法解决了问题。
跑步git remote -v在一定程度上说明了这个问题。
上面的答案都不适合我,但这是有效的。
.git/从您的项目中删除git clone https://github.com/foo/bar.git
Run Code Online (Sandbox Code Playgroud)
.git/从新位置移动到旧位置| 归档时间: |
|
| 查看次数: |
439181 次 |
| 最近记录: |