彻底解决【“curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused”】错误

 

用如下命令下载安装msf时,提示curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall

之前也遇到过类似的错误,用的解决方法是,fq工具打开全局模式,然后打开curl后面的地址(这里是:https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb),之后另存为文件,并依次执行后续命令。

上面是最简单便捷的方法,详细内容可以参考:Homebrew installation on Mac OS X Failed to connect to raw.githubusercontent.com port 443

update – 最终解决方案
最近再次遇到该问题,详细了解了下,发现是 github 的一些域名的 DNS 解析被污染,导致DNS 解析过程无法通过域名取得正确的IP地址。可以通过修改/etc/hosts文件可解决该问题。

具体而言:

打开 https://www.ipaddress.com/ 输入访问不了的域名,获得对应的IP。

使用vim /etc/hosts命令打开不能访问的机器的hosts文件,添加如下内容:

199.232.68.133 raw.githubusercontent.com
199.232.68.133 user-images.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com

注:上面内容中199.232.68.133是raw.githubusercontent.com所在的服务器IP(通过 https://www.ipaddress.com/ 获知)。

保存该文件,再使用即可正常访问。


原文链接:https://blog.csdn.net/donaldsy/article/details/107482368

posted @   程序员小艺  阅读(4046)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2020-10-18 sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'admin.role_id' could not find table 'role' with which to generate a foreign key to targe t column 'id'
点击右上角即可分享
微信分享提示