问题描述
git clone
或者pod install
,终端输出:Failed to connect to github.com port 443: Operation timed out
vpn也不行
情况一 (仓库域名无法访问)
一番操作查看了host文件中 github.com 的IP,试了一下旧的IP果然访问不了。
1、查询可以用的IP
在 https://www.ipaddress.com/ 上搜索 github.com
2、修改host文件
在Terminal中执行:sudo vi /etc/hosts
,替换成以下ip即可
140.82.112.3 github.com

3、完成
最后可以试试git clone
或者pod install
了。
情况二(需要设置代理时)
1.设置代理方法即可解决 (请自行查找你的http代理端口)
git config --global http.proxy "localhost:port"
2.完成后取消设置
git config --global --unset http.proxy
git config --global --unset https.proxy
网友评论