Git提交时报错:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity

发布于 2020-05-15  3.33k 次阅读


本文于 2020年5月15日 11:46 更新,注意查看最新内容

详细报错

git push --set-upstream origin master
Enumerating objects: 153, done.
Counting objects: 100% (153/153), done.
Delta compression using up to 4 threads
Compressing objects: 100% (133/133), done.
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
fatal: the remote end hung up unexpectedly
Writing objects: 100% (153/153), 30.44 MiB | 8.93 MiB/s, done.
Total 153 (delta 9), reused 0 (delta 0)
fatal: the remote end hung up unexpectedly
Everything up-to-date

PS:当时报错代码没有保留,以上为度娘搜寻结果。

踩坑

网上说可能是缓存不够,或者是网络不行,还有墙的问题。

于是逐一排查,首先使用了代[过滤]理,排除了网络不行和墙的问题。

再根据网上教程,修改了提交缓存大小为500M。

代码如下:

git config --global http.postBuffer 524288000
# some comments below report having to double the value:
git config --global http.postBuffer 1048576000

但在修改完提交缓存大小后,在git push时发现还是报同样的错。

解决

使用SSH方式提交

git remote set-url origin SSH地址

后话

在解决的贴子下面,我看到了另外一个声音:

通过ssh可以解决,但是这个是没办法的办法,不是作为一个技术人妥协的借口......

说实话读起来总归是有些奇奇怪怪的味道,说不上来,

我始终觉得不管方法如何,只有能解决问题的方法,才是好方法,有效的方法,

至于实现的途径是什么,那么对于结果来说,并没有那么重要。

参考

《git 推送出现 "fatal: The remote end hung up unexpectedly" 解决方案》

《使用git提交时报错:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity》

《error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large》


这短短的一生,我们最终都会失去。