访问raw.githubusercontent.com失败问题的处理

1 问题

GitHub上的项目的有些资源是放在raw.githubusercontent.com上的,通常我们在安装某些软件的时候会从该地址下载资源,直接访问的话经常容易失败。

sh 复制代码
# 安装operator
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/2.1.0_release/deploy/operator.yaml
# 报错内容
The connection to the server raw.githubusercontent.com was refused - did you specify the right host or port?

分析原因:因为神秘力量,域名解析不了,所以访问不了。

解决方法:不用域名登录,直接用ip登录,或者去/etc/hosts里设置下域名解析

2 解决方法

利用修改hosts文件的方法

hosts文件中有用的内容都以一行一行的形式排布,格式为 ip地址 + 空格 + 域名 ,比如 140.82.114.4 github.com ,这样设备在访问 github.com 时就会直接访问 140.82.114.4 这个地址了,而不用向DNS服务器查询。

2.1 查询出raw.githubusercontent.com的ip地址

我们利用查询网查询,查询网的地址为:https://www.ip138.com

查询结果为

2.2 在/etc/hosts里填写如下内容

sh 复制代码
# 把 185.199.109.133 raw.githubusercontent.com 追加到/etc/hosts

echo "185.199.109.133  raw.githubusercontent.com" >> /etc/hosts

3.2 再次执行安装语句,执行成功

sh 复制代码
# 再次执行安装operator
kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/2.1.0_release/deploy/operator.yaml
# 下面为执行成功的信息
namespace/oceanbase-system created
customresourcedefinition.apiextensions.k8s.io/obclusterbackups.oceanbase.oceanbase.com created
customresourcedefinition.apiextensions.k8s.io/obclusterrestores.oceanbase.oceanbase.com created
......

总结

总的来说修改hosts文件来解决一些网站因为DNS原因无法访问或者访问缓慢的情况还是非常方便的。这个方法也可以用于改善 github.comgithub.global.ssl.fastly.net 等网站的访问情况。

相关推荐
LIZHUOLONG18 分钟前
linux 设备初始化
linux·运维·服务器
雪霁清寒20 分钟前
麒麟V10用MobaXterm远程连接SSH偶尔卡顿的问题
linux·ssh
ylscode23 分钟前
Linux CIFSwitch 内核新漏洞允许攻击者获得 root 权限
linux·运维·服务器
JavaGuide25 分钟前
Claude Code 怎么学?推荐 4 个高质量开源教程,从入门到实战
github·ai编程·claude
诸葛务农1 小时前
共沸脱水技术及其在光刻胶用PGMEA纯化中的应用(中)
linux·数据库·人工智能
lld9510272 小时前
(二)从验证到执行:策略实时运行全链路
linux·服务器·数据库
坤昱2 小时前
cfs调度类深入解刨——最新内核细节分析5
linux·分布式·cfs调度·eevdf调度·linux调度·linux技术·kernel最新版本内容
阿洛学长2 小时前
Kali Linux 虚拟机安装(VMware Workstation 17)
java·linux·服务器
H Journey2 小时前
source命令、.bashrc 、.bash_profile、/etc/profile配置文件详解
linux·.bashrc
上天_去_做颗惺星 EVE_BLUE2 小时前
Ubuntu Android 虚拟机安装使用教程
android·linux·测试工具·ubuntu·安卓