Skip to content

如何解决类似 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused 的问题 #10

Open
@hawtim

Description

@hawtim

背景

笔者最近发现 github 的用户头像和自己文章中的图片显示不出来了。然后今天发现安装 homeBrew 和 nvm 出现了标题的报错信息。

image

以上是安装 pnpm 的报错信息,可以发现,脚本需要到 raw.githubusercontent.com 上拉取代码。

网上搜索了一下,发现是 github 的一些域名的 DNS 解析被污染,导致DNS 解析过程无法通过域名取得正确的IP地址。

DNS 污染

DNS 污染,感兴趣的朋友可以去了解一下。

解决方案

打开 https://www.ipaddress.com/ 输入访问不了的域名

image

查询之后可以获得正确的 IP 地址

在本机的 host 文件中添加,建议使用 switchhosts 方便 host 管理

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

添加以上几条 host 配置,页面的图片展示就正常了,homebrew 也能装了,nvm 也行动灵活了。

Activity

jaggerzhang

jaggerzhang commented on Jul 7, 2020

@jaggerzhang

这个方法有效 🐂🍺

Vincentzzg

Vincentzzg commented on Jul 8, 2020

@Vincentzzg

亲测有效👍👍
使用SwitchHosts配置host之后
截屏2020-07-08 下午12 58 02

一直失败的RVM安装可以正常安装了
截屏2020-07-08 下午12 58 24

whale4u

whale4u commented on Jul 10, 2020

@whale4u
alvinooc

alvinooc commented on Jul 10, 2020

@alvinooc
wangxin05

wangxin05 commented on Jul 12, 2020

@wangxin05
KittenYang

KittenYang commented on Jul 12, 2020

@KittenYang
taoeu

taoeu commented on Jul 15, 2020

@taoeu
Fun005

Fun005 commented on Jul 15, 2020

@Fun005
KDylan

KDylan commented on Jul 15, 2020

@KDylan
vitrum

vitrum commented on Jul 16, 2020

@vitrum
pinned this issue on Jul 16, 2020
Soulmate7

Soulmate7 commented on Jul 17, 2020

@Soulmate7
wq1308786830

wq1308786830 commented on Jul 17, 2020

@wq1308786830
Esmio

Esmio commented on Jul 18, 2020

@Esmio

137 remaining items

LiuLiu-55

LiuLiu-55 commented on Aug 19, 2023

@LiuLiu-55

这个方法有效

FreezingM

FreezingM commented on Mar 13, 2024

@FreezingM

@LittleCo
改了hosts文件后还是不行,但是听了这位的建议后成功了,感谢

我通过修改 DNS 为 8.8.8.8 解决了这个问题。

kokodayou2000

kokodayou2000 commented on May 30, 2024

@kokodayou2000

笨方式是浏览器打开,然后复制文字,创建文件,粘贴,然后执行

carebreadtree

carebreadtree commented on Jul 18, 2024

@carebreadtree

太牛了,四年前的神贴

Zacharyii

Zacharyii commented on Jul 27, 2024

@Zacharyii

2024/7/27亲测有效
185.199.108.133 raw.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com

安装network-manager:sudo apt-get install network-manager
重启网络:sudo systemctl restart NetworkManager

最后两步是关键

Mahironya

Mahironya commented on Aug 8, 2024

@Mahironya

It works! Thanks!

hanzili

hanzili commented on Aug 11, 2024

@hanzili

刚刚换到用Mac,想问一下为什么flush DNS没用啊

Mahironya

Mahironya commented on Aug 11, 2024

@Mahironya
hanzili

hanzili commented on Aug 11, 2024

@hanzili

刚刚换到用Mac,想问一下为什么flush DNS没用啊

应该是DNS server里的mapping被污染了

ccasJay

ccasJay commented on Nov 13, 2024

@ccasJay

大佬,我ipone端也遇到这种情况咋办啊

yong67

yong67 commented on Feb 10, 2025

@yong67

Fantastic, bravo, awesome, cool, sick! 感谢

surpass007

surpass007 commented on Mar 7, 2025

@surpass007

这是什么导致的呢?墙?
dns域名污染,当地的运营商拦截了该域名的dns query请求,回应了一个假ip给你

dale88

dale88 commented on Apr 9, 2025

@dale88

Good for you!

SuperKatrina123

SuperKatrina123 commented on Jun 1, 2025

@SuperKatrina123

update. 有用!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @uknownothingsnow@vitrum@hydyy@binarywang@wangxin05

      Issue actions

        如何解决类似 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused 的问题 · Issue #10 · hawtim/hawtim.github.io