在你使用git clone 项目的时候如果报下面这个错误。
$ git clone https://github.com/XXX/XX.git
Cloning into 'XX'...
remote: Enumerating objects: 94, done.
remote: Counting objects: 100% (94/94), done.
remote: Compressing objects: 100% (53/53), done.
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
注意:或者git - error: RPC failed; curl 18 transfer closed with outstanding read data remaining
查看git配置
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
user.email=XXX
user.name=XXX
http.lowspeedlimit=0
http.lowspeedtime=999999
http.sslverify=false
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
gui.wmstate=normal
gui.geometry=1061x563+246+76 233 255
http.postbuffer=524288000
首先出现该问题有可能是上传缓冲区大小/单位是B,你可以执行。
git config --global http.postBuffer 524288000
然后再执行
git clone https://<host_name/git/project.git
如果还继续报错,可以尝试执行下面代码,或者看你的项目大小是否还需要加大缓冲区大小
git config http.sslVerify "false"
执行上面命令如果依旧clone失败,考虑可能原因2:网络下载速度缓慢
解决方法:命令行输入
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
如果依旧clone失败,则首先浅层clone,然后更新远程库到本地
git clone --depth=1 http://gitlab.xxx.cn/yyy/zzz.git
git fetch --unshallow