Failed to connect to github.com port 443: Operation timed out

➜  HTDemo git:(main) ✗ pod install
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.1.0)

[!] Error installing AFNetworking
[!] /usr/bin/git clone https://github.com/AFNetworking/AFNetworking.git /var/folders/5z/1pd1v4ns1gjdhqmbmv83zwzh0000gn/T/d20211116-6643-tjhn1h --template= --single-branch --depth 1 --branch 3.1.0

Cloning into '/var/folders/5z/1pd1v4ns1gjdhqmbmv83zwzh0000gn/T/d20211116-6643-tjhn1h'...
fatal: unable to access 'https://github.com/AFNetworking/AFNetworking.git/': Failed to connect to github.com port 443: Operation timed out

解决:

host文件中github.com的IP应该是访问不了

1.查询可以用的IP

1.在ip查询输入搜索github.com或者直接打开

截屏2021-11-16 下午3.07.30.png
截屏2021-11-16 下午3.06.11.png

记录 github.com的IP

140.82.114.3

2.在ip查询输入搜索github.global.ssl.fastly.net或者直接打开

截屏2021-11-16 下午3.14.23.png

记录 github.global.ssl.fastly.net的IP

199.232.69.194

3.在ip查询输入搜索assets-cdn.github.com或者直接打开

截屏2021-11-16 下午3.24.01.png

记录 assets-cdn.github.com的IP

185.199.108.153 
185.199.109.153 
185.199.110.153 
185.199.111.153 
2.配置可以用的IP

在终端或者iTerm修改host文件,输入sudo vi /etc/hosts

➜  ~ sudo vim /etc/hosts

host文件中github.com相关的IP替换

140.82.114.4     github.com
199.232.69.194   github.global.ssl.fastly.net

185.199.108.153  assets-cdn.github.com
185.199.109.153  assets-cdn.github.com
185.199.110.153  assets-cdn.github.com
185.199.111.153  assets-cdn.github.com
image.png

最后我这块还需要执行➜ HTDemo git:(main) ✗ sudo killall -HUP mDNSResponder再次执行pod install

截屏2021-11-16 下午3.41.06.png

你可能感兴趣的:(Failed to connect to github.com port 443: Operation timed out)