电脑换环境后使用pod 安装依赖出现以下错误:
*******@NN MoneyBag % pod install
Analyzing dependencies
Downloading dependencies
Installing PrintBeautifulLog (1.0.0)
[!] Error installing PrintBeautifulLog
[!] /usr/local/bin/git clone https://github.com/shixueqian/PrintBeautifulLog.git /var/folders/bp/h718ffms59b_z5gppmm05l280000gn/T/d20200126-914-jnh3sd --template= --single-branch --depth 1 --branch 1.0.0
Cloning into '/var/folders/bp/h718ffms59b_z5gppmm05l280000gn/T/d20200126-914-jnh3sd'...
fatal: unable to access 'https://github.com/shixueqian/PrintBeautifulLog.git/': Failed to connect to github.com port 443: Operation timed out
然后执行 ping github.com
出现:
ping github.com (13.229.188.59): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
... ... ...
一直处于超时状态,丢包率是100%,但是网络没问题,原因是访问被墙,此时我们想clone github上的项目会一直失败。
解决方案:
1.、打开终端 然后 sudo nano /private/etc/hosts
2、然后把下面这段ip-域名映射信息复制进去:
151.101.185.194 github.global.ssl.fastly.net
192.30.253.112 github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 avatars0.githubusercontent.com
151.101.112.133 avatars1.githubusercontent.com
3、再次 ping github.com
********@NN MoneyBag % ping github.com
PING github.com (192.30.253.112): 56 data bytes
64 bytes from 192.30.253.112: icmp_seq=0 ttl=50 time=357.810 ms
64 bytes from 192.30.253.112: icmp_seq=1 ttl=50 time=257.468 ms
64 bytes from 192.30.253.112: icmp_seq=2 ttl=50 time=294.784 ms
64 bytes from 192.30.253.112: icmp_seq=3 ttl=50 time=338.158 ms
64 bytes from 192.30.253.112: icmp_seq=4 ttl=50 time=340.871 ms
64 bytes from 192.30.253.112: icmp_seq=5 ttl=50 time=363.725 ms
64 bytes from 192.30.253.112: icmp_seq=6 ttl=50 time=285.084 ms
... ... ...
说明可以正常访问了,接下来再执行 pod install
,依赖顺利安装。
解决操作记录一下
参考,感谢