Github访问加速方法

InterviewCoder

InterviewCoder

# 1. 获取延迟最小 IP 地址

首先,打开

http://tool.chinaz.com/dns?type=1&host=github.com&ip=

查询 Github 的地址,选择延迟最小的

1640222585966

1640222585966

# 2. 修改系统 Hosts 文件

接着,打开系统 hosts 文件 (需管理员权限)。
路径:C:\Windows\System32\drivers\etc

mac 或者其他 linux 系统的话,是 /etc 下的 hosts 文件,需要切入到 root 用户修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) 1993-2009 Microsoft Corp. 
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host




# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost


52.192.72.89 github.com

并在末尾添加记录并保存。(需管理员权限,注意 IP 地址与域名间需留有空格)

# 3. 刷新系统 DNS 缓存

最后,Windows+X 打开系统命令行(管理员身份)或 powershell

运行 ipconfig /flushdns 手动刷新系统 DNS 缓存。

mac 系统修改完 hosts 文件,保存并退出就可以了。不要要多一步刷新操作.
centos 系统执行 /etc/init.d/network restart 命令 使得 hosts 生效

# 关于我

Brath 是一个热爱技术的 Java 程序猿,公众号「InterviewCoder」定期分享有趣有料的精品原创文章!

InterviewCoder

InterviewCoder

非常感谢各位人才能看到这里,原创不易,文章如果有帮助可以关注、点赞、分享或评论,这都是对我的莫大支持!

评论

收藏文章
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
评论内容为空!
还没有评论,快来抢沙发吧!

热评话题

按钮 内容不能为空!
立刻说两句吧! 查看0条评论