git pull 报错:git - error: RPC failed; curl 18 transfer closed with outstanding read data remaining 解决 - Go语言中文社区

git pull 报错:git - error: RPC failed; curl 18 transfer closed with outstanding read data remaining 解决


1.美图

在这里插入图片描述

2.背景

在git pull公司项目的时候,发现报错了。报错信息如下所示:

报错信息:

fatal: The remote end hung up unexpectedly 
error: RPC failed; curl 18 transfer closed with outstanding read data remaining 
fatal: The remote end hung up unexpectedly 
fatal: early EOF 
fatal: index-pack failed

错误原因:由于Http协议错误,当Pull或者Clone的时候
因为curl的postBuffer默认值太小的原因,而项目可能本身比较大,所以下载失败。

4.配置缓冲区大小

解决方案: 在Git Bash Here 中执行:

(base) lcc@lcc bin$ git config --global http.postBuffer 524288000

解析:相当于把curl的postBuffer的值修改的大一些。524288000的单位是B,相当于500MB。

5.查看配置

(base) lcc@lcc bin$ git config --list
core.excludesfile=~/.gitignore
core.legacyheaders=false
core.quotepath=false
mergetool.keepbackup=true
push.default=simple
color.ui=auto
color.interactive=auto
repack.usedeltabaseoffset=true
alias.s=status
alias.a=!git add . && git status
alias.au=!git add -u . && git status
alias.aa=!git add . && git add -u . && git status
alias.c=commit
alias.cm=commit -m
alias.ca=commit --amend
alias.ac=!git add . && git commit
alias.acm=!git add . && git commit -m
alias.l=log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
alias.ll=log --stat --abbrev-commit
alias.lg=log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
alias.llg=log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit
alias.d=diff
alias.master=checkout master
alias.spull=svn rebase
alias.spush=svn dcommit
alias.alias=!git config --list | grep 'alias.' | sed 's/alias.([^=]*)=(.*)/1     => 2/' | sort
include.path=~/.gitcinclude
include.path=.githubconfig
include.path=.gitcredential
diff.exif.textconv=exif
credential.helper=osxkeychain
user.name=xxx@qq.com
user.email=xxxx

解析:查看配置,看看新配置是否生效。

3、然后继续执行git pull等命令即可。

注意:如果修改之后还是报相同的错误。那么不用怀疑,可能时候你的项目实在太大了。。。继续加大postBuffer的数值吧,小伙。

如果是上面的错误提示,就可以使用上述方法解决(原则上是这样,也有可能有其他错误,你懂的),但另一种情况是,红字的部分被类似如下的错误提示代替:

curl 56 OpenSSL SSL_read:SSL_ERROR_sysCALL

这就是:

SSL错误
因为服务器的SSL证书没有经过第三方机构的签署,所以才报错。解决方案如下:
第一步,克隆远程仓库时,用env命令设置GIT_SSL_NO_VERIFY环境变量为”ture”,并同时调用正常的git clone命令。完整的命令如下:

env GIT_SSL_NO_VERIFY=true git clone https://<host_name/git/project.git

第二步,在克隆完毕的仓库中将http.sslVerify设置为”false”。完整的命令如下:

git config http.sslVerify "false"

点评:以上方法应该是Git处理可信任的SSL临时证书很好的方法,第一步使用env命令保证了忽略证书错误是单次行为,不会成为默认的设置。第二次,则把忽略证书错误的设置限定在特定的仓库,避免扩大该设置的适用范围而引起的潜在安全风险。

我的目的是想传一些大文件到github上,要是用大文件存储也就是LFS(large file storage),我一直以为是大文件的问题或者是网络的问题(因为可能需要翻墙),想不到最后是证书认证的问题,查找问题还是要一丝不苟啊!

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_21383435/article/details/87186423
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢