git克隆失敗的解決辦法:1、執(zhí)行“git config –global http.postBuffer 524288000”命令;2、將IP地址添加到/etc/hosts中;3、刷新dns緩存。
本文操作環(huán)境:Windows10系統(tǒng)、Git 2.30.0版、Dell G3電腦。
git 克隆失敗怎么辦?
使用 git 克隆 github 上的項目失敗
現(xiàn)象
今天在使用 git clone nextjs demo project 源代碼的時, git clone https://github.com/XXXX/next-blog.git 下載速度很慢,然后下載一段時間后,總是提示下面的錯誤信息
nCloning into 'next-blog'... remote: Enumerating objects: 111, done. remote: Counting objects: 100% (111/111), done. remote: Compressing objects: 100% (83/83), 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
原因
由于Http協(xié)議錯誤,當 pull 或者 clone 的時候,或者是 github 某個CDN被偉大的墻屏蔽所致。
解決辦法
協(xié)議錯誤
-
先執(zhí)行下列命令
git config --global http.postBuffer 524288000
- 再執(zhí)行git pull 或者 git clone命令
墻屏蔽
- 訪問 http://github.global.ssl.fast…
獲取cdn域名以及IP地址 - 訪問 http://github.com.ipaddress.c… 獲取cdn域名以及IP地址
-
將上述獲取的IP地址添加到/etc/hosts中
sudo vim /etc/hosts
-
刷新dns緩存
sudo killall -HUP mDNSResponder sudo dscacheutil -flushcache
結果
再執(zhí)行 git clone 的操作的時候,速度颼颼颼的上去了,一下子達到幾百Kb啦~
推薦學習:《Git教程》
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦