Github加速设定

这篇文章memo一下github下载的设定方式。

设定内容

将一下内容设定到hosts设定文件中

设定IP地址 域名信息
192.30.253.112 github.com
151.101.72.133 assets-cdn.github.com
151.101.193.194 github.global.ssl.fastly.net

IP查询地址:https://www.ipaddress.com/
以github.com为例:
Github加速设定_第1张图片

设定方法(Linux/Mac)

将上述设定内容设定到下面的hosts文件中即可

设定文件:
/etc/hosts

设定方法(Windows)

将上述设定内容设定到下面的hosts文件中即可

设定文件:
Windows\System32\drivers\etc\Hosts

辅助步骤:
ipconfig /flushdns
注:windows需要手动进行flushdns操作方可起效

设定示例

以下以easypack的git clone动作为例,操作日志如下所示,目前4M左右,10s上下还是可以接受的程度。

  • Linux(CentOS7.5)
[root@host131 tmp]# tail -n3 /etc/hosts
192.30.253.112  github.com
151.101.72.133  assets-cdn.github.com
151.101.193.194 github.global.ssl.fastly.net
[root@host131 tmp]# time -p git clone http://github.com/liumiaocn/easypack.git
Cloning into 'easypack'...
remote: Enumerating objects: 405, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (248/248), done.
remote: Total 2119 (delta 189), reused 307 (delta 108), pack-reused 1714
Receiving objects: 100% (2119/2119), 1.81 MiB | 300.00 KiB/s, done.
Resolving deltas: 100% (995/995), done.
real 11.80
user 0.12
sys 0.23
[root@host131 tmp]#
  • MacOS
liumiaocn:sss liumiao$ tail -n3 /etc/hosts
192.30.253.112  github.com
151.101.72.133  assets-cdn.github.com
151.101.193.194 github.global.ssl.fastly.net
liumiaocn:sss liumiao$ time -p git clone http://github.com/liumiaocn/easypack.git
Cloning into 'easypack'...
warning: redirecting to https://github.com/liumiaocn/easypack.git/
remote: Enumerating objects: 405, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (248/248), done.
remote: Total 2119 (delta 189), reused 307 (delta 108), pack-reused 1714
Receiving objects: 100% (2119/2119), 1.81 MiB | 242.00 KiB/s, done.
Resolving deltas: 100% (995/995), done.
real 10.39
user 0.24
sys 0.18
liumiaocn:sss liumiao$ 

你可能感兴趣的:(工具)