- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
- curl: (7) Failed to connect to r
一、报错内容
今天在安装nvm的时候
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
遇到了这样的错误:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

二、问题原因
github 的一些域名的 DNS 解析被污染,导致DNS 解析过程无法通过域名取得正确的IP地址。
什么是DNS污染?🤔
三、解决办法
1. 第一步:获取正确的IP地址
打开 https://www.ipaddress.com/ 输入访问不了的域名

2. 第二步:修改hosts
① 获取到正确的IP地址后,在终端输入:
$ sudo 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
网友评论