1.修改本地hosts文件
# windows系统的hosts文件的位置如下:C:\Windows\System32\drivers\etc\hosts
# linux系统的hosts文件的位置如下:/etc/hosts
sudo gedit /etc/hosts
2.增加github的映射
首先获取Github相关网站的ip,访问 https://www.ipaddress.com ,点击左侧 IP Address Lookup
分别输入
github.global.ssl.fastly.net
raw.githubusercontent.com
github.com
点击查询ip地址
按下列格式添加到hosts文件中(下面是我的配置,由于ip地址会经常变更,需要自己重新查找)
185.199.110.133 raw.githubusercontent.com
140.82.121.4 github.com
146.75.121.194 github.global.ssl.fastly.net
3.终端输入ping github.com进行测试
有速度了
ps:在windows修改hosts后需要在cmd中输入指令 ipconfig /flushdns 刷新DNS