Ryan's WorkSpace
  • 首页
  • 关于我
  1. 首页
  2. Git
  3. 正文

使用Host为Github加速

2020年03月17日 1230点热度 4人点赞 0条评论

内容纲要

背景

由于众所周知的原因,Github从国内访问速度特别的慢。
而我们需要从Github上面Clone代码的时候,这个网速就特别令人心烦。
为了解决这个问题,可以通过众所周知的方法,或者使用更改Host加速访问Github。

事实上Github的DNS配置了多个A记录,通过RoundRobin随机选择一个IP连接。
而我们通过使用Host指定IP,可以强制使用网速最快的那一批连接Github。

正文

将以下记录加入hosts文件中。

192.30.253.118 gist.github.com
185.199.109.153 assets-cdn.github.com
199.232.68.133 raw.githubusercontent.com
199.232.68.133  gist.githubusercontent.com
199.232.68.133 cloud.githubusercontent.com
199.232.68.133 camo.githubusercontent.com
199.232.28.133 avatars0.githubusercontent.com
199.232.28.133 avatars1.githubusercontent.com
199.232.28.133 avatars2.githubusercontent.com
199.232.28.133 avatars3.githubusercontent.com
199.232.28.133 avatars4.githubusercontent.com
199.232.28.133 avatars5.githubusercontent.com
199.232.28.133 avatars6.githubusercontent.com
199.232.28.133 avatars7.githubusercontent.com
199.232.28.133 avatars8.githubusercontent.com

Windows

Windows可更改C:\Windows\System32\Drivers\etc\hosts
更改后使用ipconfig /flushdns清除DNS缓存

macOS

macOS可更改/etc/hosts


Linux

Linux可更改/etc/hosts

相关

本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: GitHub Linux
最后更新:2020年03月17日

Ryan Lee

如果帮助到你,请点击广告,谢谢!

点赞
< 上一篇

文章评论

您需要 登录 之后才可以评论

如果帮助到你,请点击广告,谢谢!

用户您好!请先登录!
登录 注册
Social Media
Github: ryanlee2014
标签聚合
C GitHub hustoj php Apache JavaScript Java C++
友链
Pacolyon
Lucien's blog
Slian's DreamWork
卡拉搜索
  • 0
  • 15,288
  • 5,537
  • 0
广告

COPYRIGHT © 2020 Ryan's WorkSpace. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS

登录
注册|忘记密码?