今天在使用 git clone nextjs demo project 源代碼的時, git clone https://github.com/XXXX/next-blog.git
下載速度很慢,而後下載一段時間後,老是提示下面的錯誤信息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協議錯誤,當 pull 或者 clone 的時候,或者是 github 某個CDN被偉大的牆屏蔽所致。github
先執行下列命令shell
git config --global http.postBuffer 524288000
將上述獲取的IP地址添加到/etc/hosts
中vim
sudo vim /etc/hosts
刷新dns緩存緩存
sudo killall -HUP mDNSResponder sudo dscacheutil -flushcache
再執行 git clone 的操做的時候,速度颼颼颼的上去了,一會兒達到幾百Kb啦~curl