手動修改hosts文件(Mac):
1、打開hosts文件
- 打開Finder,commond + shift + g,輸入/private/etc/hosts前往hosts文件
或 - 使用終端命令(注意vi后面有個空格):sudo vi /etc/hosts
2、打開后英文狀態下輸入i,進入編輯模式
3、查詢域名對應的IP
3、修改GitHub對應的完整host,格式就是下面這樣:
151.101.185.194 github.global.ssl.fastly.net
192.30.253.112 github.com
192.30.253.120 codeload.github.com
185.199.108.153 assets-cdn.github.com
204.232.175.78 documentcloud.github.com
204.232.175.94 gist.github.com
107.21.116.220 help.github.com
207.97.227.252 nodeload.github.com
199.27.76.130 raw.github.com
107.22.3.110 status.github.com
204.232.175.78 training.github.com
185.31.18.133 avatars0.githubusercontent.com
185.31.19.133 avatars1.githubusercontent.com
基本修改前4個就夠了,上面的IP最好自己查下最新的,如果你懶得查就用我的前四個,親測妥妥的
4、按ESC退出,緊接著按shift + :,輸入wq保存
5、更新DNS緩存
- 命令行輸入:sudo dscacheutil -flushcache,使增加的映射生效。