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


最近在安装gin框架时下载项目示例代码到本地再次遇到该问题,详细了解了下是 github 的一些域名的 DNS 解析被污染,导致DNS 解析过程无法通过域名取得正确的IP地址。可以通过修改/etc/hosts文件可解决该问题。

具体步骤:

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

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

185.199.108.133  raw.Githubusercontent.com

185.199.109.133  raw.Githubusercontent.com

185.199.110.133  raw.Githubusercontent.com

185.199.111.133  raw.Githubusercontent.com

 185.199.xxx.133 通过www.ipaddress.com获取到

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

 

posted @ 2022-08-05 10:43  php小小菜鸟  阅读(4613)  评论(0编辑  收藏  举报