git拉代码时报错error: RPC failed; curl 56 Recv failure: Connection reset by peer  fatal: The remote end hu

 git clone代码时,如果项目总大小比较小时克隆代码没问题,占用内存比较大时就会如下报错

TAndroid-03deMac-mini:mytest xwx$ git clone http://git.mygit.com/myproject.git

Cloning into 'git.mygit.com'...

remote: Enumerating objects: 81184, done.

remote: Counting objects: 100% (81184/81184), done.

remote: Compressing objects: 100% (34062/34062), done.

error: RPC failed; curl 56 Recv failure: Connection reset by peer  

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

解决方案:

1.查看git全局配置:git config --global --list

TAndroid-03deMac-mini:htdocs xwx$ git config --global --list
user.name=gongzhu
user.email=122227556@163.com
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
core.excludesfile=/Users/android_03/.gitignore_global
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
commit.template=/Users/android_03/.stCommitMsg
http.postbuffer=524288000
TAndroid-03deMac-mini:htdocs xuwenxiong$ 

2.找到http.postbuffer,比较这个大小是否远比你项目的占用内存大,我项目497MB,这里只有500MB克隆不了代码,虽然500>497,但还是clone不了,设置成1GB后clone成功。

3.设置传送的缓存大小(即http.postBuffer的值,单位为B,1GB = 1024*1024*1000 B = 1048576000 B):

git config --global http.postBuffer 1048576000

4.497MB的项目是clone成功啦,但809MB的项目克隆失败,设置成2GB后克隆成功。

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值