起因
最近新接手一个项目,拉取源码后,pod install时间长,还老失败,花了很长时间才搞定,特来记录一下。
主要原因
主要是就一些库在国外无法正常获取,导致pod install的时候被卡主,时间长了失败
解决方案
开VPN访问,并设置全局代理
通过shadowssocks查看到本地socks5的本地地址和端口号。再打开终端输入:
git config --global https.https://github.com.proxy socks5://127.0.0.1:1086
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
图
常用到的命令
pod install --verbose用于查看安装库的详情,如果卡在某一个库,可以cd到那个库中的安装地址,然后使用du -sh查看已经安装的大小git config --list用于查看设置全局代理是否成功- 用于取消设置代理的命令
git config --global --unset http.proxy
git config --global --unset https.proxy
使用到的其他解决方案
修改host文件以便于快速访问github
- 进入host文件
sudo vim /etc/hosts - host文件末尾加入
140.82.113.3 github.com和199.232.69.194 github.global.ssl.fastly.net - 去除DNS缓存
sudo killall -HUP mDNSResponder