➜ 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
记录 github.com
的IP
140.82.114.3
2.在ip查询输入搜索github.global.ssl.fastly.net
或者直接打开
记录 github.global.ssl.fastly.net
的IP
199.232.69.194
3.在ip查询输入搜索assets-cdn.github.com
或者直接打开
记录 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
最后我这块还需要执行➜ HTDemo git:(main) ✗ sudo killall -HUP mDNSResponder
再次执行pod install