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下载慢的问题解决方法记录-腾讯云开发者社区-腾讯云

相关推荐
阿里嘎多学长21 小时前
2026-07-10 GitHub 热点项目精选
开发语言·程序员·github·代码托管
今夕资源网1 天前
AI声音克隆软件 CosyVoice今夕一键整合包解压即用 阿里巴巴通义实验室开源 github斩获22K星标
人工智能·github·多国语言·声音克隆·零样本语音克隆·感情·ai语音克隆
胡萝卜术1 天前
从聊天模型到本地执行助手:Remote MCP 多工具 Agent 实战
面试·架构·github
慕容引刀1 天前
告别Commit信息纠结:使用Git AI Commit插件实现规范化提交
人工智能·git·github·visual studio code·visual studio
GoGeekBaird2 天前
我开源了 BeeWeave,给 AI Agent 搭一个越用越懂你的知识创作台
后端·github
fthux2 天前
GitZip Pro 源码解析:一个 GitHub 文件/文件夹下载扩展是如何工作的(一)整体架构与扩展入口
人工智能·ai·开源·github·open source
第一程序员2 天前
Rust Agent 子进程执行:Command 之前,先定义输入和超时
python·rust·github
2501_936960362 天前
GitHub初步了解
github
wangruofeng2 天前
11 万 Star 的生成式 AI 入门课,Microsoft 做对了什么
github·aigc·ai编程
IOT那些事儿2 天前
GitHub Profile 429: Too Many Requests
github·profile·429