github通过修改hosts访问

ubuntu系统下,常常因为国内网络原因无法访问github官网或者也无法使用使用git clone指令,搭建梯子又过于复杂,可使用修改hosts文件,添加IP地址的方法改进。

修改Hosts文件:

1、打开DNS查询网站:DNS查询站长工具 - 站长之家

也可通过工具查看DNS:

bash 复制代码
nslookup github.com
nslookup github.global.ssl.fastly.net 

2、输入github域名:http://github.com,点击检测。

3、选择合适的IP地址,复制。

4、将IP地址复制到Hosts文件中。

bash 复制代码
#打开Hosts文件 
sudo gedit /etc/hosts 

# 添加IP地址及域名 如 :
20.205.243.166 github.com 
151.101.129.194 github.global.ssl.fastly.net

5、刷新DNS

bash 复制代码
#刷新 
sudo service network-manager restart

6、其它域名汇总

bash 复制代码
#GitHub Start 
140.82.113.3 github.com 
140.82.114.20 gist.github.com 
151.101.184.133 assets-cdn.github.com 
151.101.184.133 raw.githubusercontent.com 
151.101.184.133 gist.githubusercontent.com 
151.101.184.133 cloud.githubusercontent.com 
151.101.184.133 camo.githubusercontent.com 
151.101.184.133 avatars0.githubusercontent.com 
199.232.68.133 avatars0.githubusercontent.com 
199.232.28.133 avatars1.githubusercontent.com 
151.101.184.133 avatars1.githubusercontent.com 
151.101.184.133 avatars2.githubusercontent.com 
199.232.28.133 avatars2.githubusercontent.com 
151.101.184.133 avatars3.githubusercontent.com 
199.232.68.133 avatars3.githubusercontent.com 
151.101.184.133 avatars4.githubusercontent.com 
199.232.68.133 avatars4.githubusercontent.com 
151.101.184.133 avatars5.githubusercontent.com 
199.232.68.133 avatars5.githubusercontent.com 
151.101.184.133 avatars6.githubusercontent.com 
199.232.68.133 avatars6.githubusercontent.com 
151.101.184.133 avatars7.githubusercontent.com 
199.232.68.133 avatars7.githubusercontent.com 
151.101.184.133 avatars8.githubusercontent.com 
199.232.68.133 avatars8.githubusercontent.com

参考文章:

1、网站dns查询

站长工具 - 站长之家

2、解决ubuntu无法正常访问github的问题(添加的域名比较全)

解决ubuntu无法正常访问github的问题_ubuntu无法访问github-CSDN博客

3、Ubuntu上Github下载慢的问题解决方法记录(linux自带工具查看网址的DNS)

Ubuntu上Github下载慢的问题解决方法记录-腾讯云开发者社区-腾讯云

相关推荐
doup智能AI2 小时前
数据分析师:报表自动生成与洞察——AI 员工系列 Vol.4
github
答案answer2 小时前
Three.js3D编辑器必备的相机视图插件
开源·github·three.js
RickeyBoy12 小时前
Git Worktree / Worktrunk:并行 AI 开发工作流实战
github·vibecoding
逛逛GitHub18 小时前
55 个 AI Agent 组成虚拟公司开源,2 天就 1 万星
github
Tapir1 天前
被 Karpathy 下场推荐的 NanoClaw 是什么来头
前端·后端·github
ShingingSky1 天前
用 Claude Skill 改造 AgentTeams:我实现了 AI 协作的质变
github
Moment1 天前
MinIO已死,MinIO万岁
前端·后端·github
草梅友仁1 天前
OpenClaw AI 助手实测与墨梅博客更新 | 2026 年第 10 周草梅周报
开源·github·ai编程
ExcellentWe2 天前
你的AI写的代码总是不理想?这个开源免费的工程流水线编排工具super-dev帮你解决
github
Moment2 天前
腾讯终于对个人开放了,5 分钟在 QQ 里养一只「真能干活」的 AI 😍😍😍
前端·后端·github