在本地host文件中添加映射,步骤如下:

1.用文本编辑器打开hosts文件,位于C:\Windows\System32\drivers\etc目录下;
Linux下路径:/etc/hosts

2.打开 http://tool.chinaz.com/dns ,这是一个查询域名映射关系的工具

3.查询 github.global.ssl.fastly.net 和 assets-cdn.github.com 两个地址

4.多查几次,选择一个稳定,延迟较低的 ip 按如下方式添加到host文件

5.保存文件

6.刷新DNS

ipconfig /flushdns  // ipconfig和/flushdns之间有个空格才行
  • 1

host文件:

# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

# github
192.30.253.112 assets-cdn.github.com
151.101.88.249 github.global.ssl.fastly.net
192.30.253.113 github.com
151.101.184.133 assets-cdn.github.com
185.199.108.153 documentcloud.github.com
192.30.253.118 gist.github.com
185.199.108.153 help.github.com
192.30.253.120 nodeload.github.com
151.101.184.133 raw.github.com
18.204.240.114 status.github.com
192.30.253.166 training.github.com
192.30.253.112 www.github.com
151.101.185.194 github.global.ssl.fastly.net
151.101.184.133 avatars0.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com