执行 pod install 出现 “Failed to connect to github.com port 443: Operation timed out”解决方案

电脑换环境后使用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,依赖顺利安装。
解决操作记录一下
参考,感谢👍👍👍

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 文章前先声明,本人此次出现问题时使用操作系统为 Win 10。 本来风和日丽的一天,想往 GitHub 上提交点文...
    Cloneable阅读 7,699评论 0 1
  • 3.16 解决办法使用SSH 配置github SSH git config --global user.emai...
    最晴天阅读 5,468评论 0 2
  • Ruby 安装 要安装cocospods 首先需要安装ruby,可以先安装xcode,再安装macport ,最后...
    山天大畜阅读 1,911评论 0 1
  • 那年夏天 狗吐舌头的日子出奇长 知了不知疲倦地总叫 我的婆婆在床上躺了三个多月 每次只要听到门口有声响 总问 是不...
    恰妈阅读 167评论 0 7
  • 所有的想法和感受都是创造性的。你在多大程度上认为它是真实的,你就会在多大程度上经验到它。
    田蜜悦阅读 113评论 0 0