git push 报错:error: RPC failed; result=22, HTTP code = 413 fatal: The remote end hung up unepectedly

  目录

一、问题描述

二、解决方法

2.1 方法一:将传输方式由 http 改为 ssh (推荐)

2.2 修改提交缓存大小为500M,或者更大

2.3 设置 git 最低速度和最低速度时间

三、总结

四、参考链接


一、问题描述

git 在 push 的时候可能会出现如下错误:

error: RPC failed; result=22, HTTP code = 413
fatal: The remote end hung up unepectedly 

出现这个错误的主要原因是传输的内容比较大。

二、解决方法

本文测试均以本人新建的 github 仓库 My_String 为例进行说明,其中克隆该仓库使用的是 http 方式。

2.1 方法一:将传输方式由 http 改为 ssh (推荐)

如果使用的是 http 传输,将其改为 ssh 传输。

(1)使用 git remote -v 查看你的连接情况,确认当前使用的是 http 方式,如下所示:

[root@bogon My_String]# git remote -v
origin  https://github.com/New-World-2019/My_String.git (fetch)
origin  https://github.com/New-World-2019/My_String.git (push)
[root@bogon My_String]#

2. 在 github My_String 仓库中复制 ssh 的连接,如下图所示:

3. 修改传输方式 http 为 ssh,执行命令 git remote set-url origin "SSH连接",如下所示:

[root@bogon My_String]# git remote set-url origin git@github.com:New-World-2019/My_String.git
[root@bogon My_String]# git remote -v
origin  git@github.com:New-World-2019/My_String.git (fetch)
origin  git@github.com:New-World-2019/My_String.git (push)
[root@bogon My_String]#

改完之后,正常 push 就可以啦。

2.2 修改提交缓存大小为500M,或者更大

执行命令 git config --global http.postBuffer Size 进行设置,如下所示:

[root@bogon My_String]# git config --global http.postBuffer 524288000
[root@bogon My_String]# git config --global http.postBuffer 1048576000

2.3 设置 git 最低速度和最低速度时间

执行命令 git config --global http.lowSpeedLimit Time 进行设置,如下所示:

[root@bogon My_String]# git config --global http.lowSpeedLimit 0
[root@bogon My_String]# git config --global http.lowSpeedTime 999999

三、总结

我推荐使用第一种方式,另外两种方式治标不治本,另外,建议不要将不使用的/不重要的/可执行文件传输到仓库中,这可以通过仓库下.gitignore 进行筛选,如果没有新建一个即可。

四、参考链接

[1] https://blog.csdn.net/weixin_38450840/article/details/80701173

[2] https://blog.csdn.net/WangYouJin321/article/details/106329757

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Linux猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值