git拉代码时报错error: RPC failed; curl 56 Recv failure: Connection reset by peer fatal: The remote end hu
程序员文章站
2022-06-18 14:09:18
git clone代码时,如果项目总大小比较小时克隆代码没问题,占用内存比较大时就会如下报错TAndroid-03deMac-mini:mytest xwx$ git clone http://git.mygit.com/myproject.gitCloning into 'git.mygit.com'...remote: Enumerating objects: 81184, done.remote: Counting objects: 100% (81184/81184), done....
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后克隆成功。
本文地址:https://blog.csdn.net/qq_31752115/article/details/108118260
上一篇: 电脑DOS命令查看进程详细信息方法图解