cocopods 提高 pod install速度

2020-05-09  本文已影响0人  smallLabel

目前感觉最快的方式,换DNS为119.29.29.29,如果DNS都不行的话再看👇

注:此处仅介绍CDN挂代理加速方法,如果本地有master的话,就在podFile中添加source,下面介绍的3步骤就不要使用了

  1. 开启科学上网
  2. 配置git 代理
// 注意端口号不一定必须是1080
// 以下两种设置代理的方式二选一,推荐设置socks5
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080

git config --global --unset http.proxy // 取消代理
git config --global --unset https.proxy // 取消代理
  1. 删除pod下其他repo,保留CDN类型的trunk,可以使用pod repo list查看repo,使用pod repo remove master删除masterrepo
  2. 在hosts文件中添加如下
151.101.108.133 raw.githubusercontent.com

其中IP可能会发生变化,可以上这个网站查询域名对应IP

PS:

cd ~/.cocoapods/repos 
pod repo remove master
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

最后进入自己的工程,在自己工程的podFile第一行加上:

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

缺点就是每次都要加source

上一篇 下一篇

猜你喜欢

热点阅读