错误原因
由于Http协议错误,当 pull 或者 clone 的时候,或者是 github 某个CDN被伟大的墙屏蔽所致。
解决办法1
协议错误
先执行下列命令
git config --global http.postBuffer 524288000
再执行git pull
或者 git clone
命令
解决办法2
墙屏蔽
-
访问 http://github.global.ssl.fast...获取cdn域名以及IP地址
-
访问 http://github.com.ipaddress.c... 获取cdn域名以及IP地址
修改hosts文件
将上述获取的IP地址添加到hosts文件中
Mac在/etc/hosts
中;
windows在C:WindowsSystem32driversetchosts
中;
# fix git clone github project failed
140.82.113.3 github.com
199.232.5.194 github.global.ssl.fastly.net
刷新DNS缓存
Mac刷新DNS缓存
sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache
Windows更新DNS缓存
cmd命令窗口执行:
ipconfig /flushdns
使增加的映射生效。