GitHub代碼總是拉取失敗,本文的解決方法可以幫到你
- 2019 年 12 月 16 日
- 筆記
每次從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
掃碼關注,學得更多