解决github访问慢的问题

参考:

  1. https://blog.csdn.net/QLeelq/article/details/118441958?spm=1001.2014.3001.5501
  2. https://blog.csdn.net/weixin_45126117/article/details/103160228
  3. https://baijiahao.baidu.com/s?id=1616353495084098905&wfr=spider&for=pc

1. 检查本地网速:

以我电脑为例:ping baidu.com 发现网速还不算太卡,但是ping github.com 发现进不去,显示的是“请求超时”:
解决github访问慢的问题_第1张图片
接下来就需要修改hosts文件。

2. 查询ip:

  • 需要自己去打开Dns检测|Dns查询 - 站长工具:http://tool.chinaz.com/dns?type=1&host=github.com&ip=

  • 在检测输入栏中输入http://github.com官网:
    解决github访问慢的问题_第2张图片

3. 对hosts文件进行修改:

注意修改之前最好将原hosts文件做一个备份!!!)

  • Windows的hosts文件位置:
C:\Windows\System32\drivers\etc\hosts
  • Linux或Mac的hosts文件位置:
/etc/hosts
  • 把检测列表里的TTL值最小的IP地址输入到hosts文件的末尾,并对应写上github官网域名,形式如下:
13.114.40.48 github.com

4. 刷新DNS:

  • Windows:
ipconfig /flushdns
  • Mac:
    解决github访问慢的问题_第3张图片

1)最新的 OS X 上刷新DNS应该是 :

sudo killall -HUP mDNSResponder

2)其他版本的刷新命令如下:

Mac OS X 10.7 – 10.8:sudo killall -HUP mDNSResponder

Mac OS X 10.5 – 10.6:dscacheutil -flushcache

Mac OS X 10.4:lookupd -flushcache

  • Linux:
sudo /etc/init.d/networking restart

OK啦~

你可能感兴趣的:(github,http,https)