解决Github连接缓慢、图裂问题

一、解决Github连接缓慢、图裂问题?

1.通过修改本地hosts文件加速github

1.1 手动修改更新

首先我们需要找到自己设备上的hosts文件,不同的平台其存放路径各不相同,主要的平台hosts文件所在路径如下:

  • Windows :C:\Windows\System32\drivers\etc\hosts
  • Linux:/etc/hosts
  • Mac:/etc/hosts
    以windos为例:
    解决Github连接缓慢、图裂问题

这是一个无拓展名的文件,我们可以使用记事本、notepad++等文本编辑器来打开它,将下面的内容(这部分内容会自动更新,)复制,并粘贴到hosts文件的最后:

#GitHub520 Host Start
185.199.108.154 github.githubassets.com
199.232.68.133 camo.githubusercontent.com
199.232.68.133 github.map.fastly.net
199.232.69.194 github.global.ssl.fastly.net
140.82.113.3 github.com
140.82.112.5 api.github.com
199.232.68.133 raw.githubusercontent.com
199.232.68.133 user-images.githubusercontent.com
199.232.68.133 favicons.githubusercontent.com
199.232.68.133 avatars5.githubusercontent.com
199.232.68.133 avatars4.githubusercontent.com
199.232.68.133 avatars3.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com
199.232.68.133 avatars0.githubusercontent.com
#GitHub520 Host End

如图所示:
解决Github连接缓慢、图裂问题
![注意若是该文件为只读模式可通过notpad++软件右键该文件名修改为可编辑模式,添加后再改回只读模式]