Skip to content

国内机子使用github如何加速

国内的机器上用git clone之类就是慢,那么如何加速呢 – 原理很简单,手动将重要的域名解析到对的IP上面。

找到重要域名和IP的对应关系

查找

  • github.com
  • raw.githubusercontent.com
  • assets-cdn.github.com
  • gist.github.com
  • github-cloud.s3.amazonaws.com

修改hosts文件

# 在 /etc/hosts加入对应关系即可
echo -e "199.232.28.133 raw.githubusercontent.com \n140.82.114.3 github.com \n185.199.108.153 assets-cdn.github.com \n199.232.69.194 github.global.ssl.fastly.net \n52.216.141.132 github-cloud.s3.amazonaws.com \n140.82.113.3 gist.github.com" >> /etc/hosts

reset local dns cache

systemd-resolve --flush-caches
systemd-resolve --statistics
# make sure "Current Cache Size" is 0

Leave a Reply

Your email address will not be published.