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

相关推荐
go54631584657 小时前
本地部署 GitHub 上的 Python 人脸识别项目
开发语言·python·github
程序视点1 天前
惊喜升级!Claude 3.7 Sonnet 上线 GitHub Copilot!已全账号开放!
github·claude·github copilot
今晚打老虎z1 天前
MailKit: 在 .NET 中实现高效电子邮件发送与接收
git·github·.net
架构文摘JGWZ1 天前
5个GitHub热点开源项目!!
学习·github·工具
液态不合群2 天前
DeepSeek “源神”启动!「GitHub 热点速览」
github
JNU freshman2 天前
github 推送的常见问题以及解决
git·github
cjchsh2 天前
ctfhub-web信息泄露通关攻略
windows·python·github
五行缺觉3282 天前
ROS ur10机械臂添加140夹爪全流程记录
c++·经验分享·机器人·github·ur机械臂·moveit!
無炆_2 天前
IDEA-插件开发踩坑记录-第五坑-没有飞机场导致无法访问GITHUB导致的讨厌问题
java·github·intellij-idea
cccccchd2 天前
github如何创建空文件夹
github