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

相关推荐
峰向AI5 小时前
还在手动配 SSL 证书?这个 75K Star 的 Web 服务器让 HTTPS 自动到起飞
github
Java陈序员6 小时前
轻量运维面板!一款现代化的服务器控制面板工具!
运维·服务器·python·react.js·github
u1301308 小时前
GitHub 热榜项目:日榜(2026-09-10)
github
用户2136863783529 小时前
给 DeepSeek Harness 写了个「技能熔炉」:任何来源的 SKILL.md 一条命令装上
github
七牛开发者10 小时前
告别反复调参,一个 Skill 让 AI 掌握论文图的视觉语法:以 DeepSeek V4.1 Flash 论文图为例
github·agent·deepseek
简创AIGC陶先生10 小时前
【直播切片工作台】第11章:剪辑项目模型 VideoProject
github
MicrosoftReactor11 小时前
技术速递|如何在不牺牲任务质量的前提下,让 AI 编码更具成本效益
人工智能·ai·github·copilot
中科三方11 小时前
DNS拨测到底在拨测什么?
开发语言·github·php·dns·云拨测
digital-Yun15 小时前
Harness 深度图解
github
码流怪侠17 小时前
Sunshine 深度拆解:当 NVIDIA GameStream 闭源后,如何用 4 万颗 Star 重建自托管云游戏
游戏·github·nvidia