一、
-
查询github的IP:http://github.com.ipaddress.com/
-
查询github.global.ssl.fastly.net的IP:http://github.global.ssl.fastly.net.ipaddress.com/
二、
到https://site.ip138.com/分别查询github.com和github.global.ssl.fastly.net的IP,选择有效的IP地址 Windows(C:\Windows\System32\Drivers\etc) 、Mac(shift+command+g-> 输入/etc/hostos)路径下找到hosts文件,复制到其他位置打开,在hosts文件尾部添加查询到的IP地址:
#github
github的IP github.com
github.global.ssl.fastly.net的IP github.global.ssl.fastly.net
- 保存,将hosts文件复制回原来位置并替换
- 刷新DNS缓存
//Windows下终端执行
ipconfig /flushdns
//mac
lookupd -flushcache(或 type dscacheutil -flushcache 或 sudo killall -HUP mDNSResponder)//视系统版本而定
//Linux系统
/etc/rc.d/init.d/nscd restart(或 /etc/init.d/nscd restart,如果是systemd管理服务,则systemctl restart nscd )
!!! 提示:如果没有解决,重启终端试试!