GitHub代码总是拉取失败,本文的解决方法可以帮到你

每次从GitHub拉取代码,总是到要成功的时候报错了,是真的烦。试试下面的解决方法,应该可以帮到你。

【错误一】:

Cloning into '/opt/exploit-database'...

remote: Counting objects: 106517, done.

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

error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

【问题原因】

一般是由于大文件造成的提交或者拉取失败,curl的postBuffer默认值太小,增大缓存配置就好了

【解决办法】

git config --global http.postBuffer 1048576000

【错误二】

Git error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54

error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

【问题原因】

对于 errno 54 这个错误,经常是 http 或者 https 协议都无法正常提交。必须改为 ssh 方式来提交代码。也就是必须使用公私钥的方式进行账号验证,并提交代码。

【解决办法】

在GitHub中配置SSH key

如果本地没有ssh key 的话,先生成ssh信息

> ssh-keygen -t rsa -C "邮箱"

然后根据提示连续回车即可在~/.ssh目录下得到id_rsa和id_rsa.pub两个文件,id_rsa.pub文件里存放的就是我们要使用的key

查看id_rsa.pub信息,并复制

cat ~/.ssh/id_rsa.pub

登录到GitHub,在Accounting settings中选择SSH key, 点击Add SSH key

配置完成后测试是否配置成功

> ssh -T [email protected]
Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.

看到上面的信息,就表示SSH key配置成功了。

【错误三】:

Cloning into '/opt/exploit-database'...

remote: Counting objects: 106517, done.

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

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

【问题原因】

可能在网上找了很多办法都试了,简直要绝望了,还是不行。可能是公司网络连接GitHub比较慢,下载的时候总是超时断开导致拉取失败。

【问题解决】

增加最低速度连接时间

git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999

扫码关注,学到更多

扫码关注,学到更多

发布了115 篇原创文章 · 获赞 67 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/meifannao789456/article/details/103480127