Cocopods遇到的问题
cocopods的specs文件下载不下来。
之前的gem sources等等略过不提。
1. 翻个墙
$ ~curl ip.gs
$ ~sudo /usr/local/sbin/privoxy /usr/local/etc/privoxy/config
$ ~netstat -na | grep 8118
tcp4 0 0 *.8118 *.* LISTEN
tcp4 0 0 127.0.0.1.8118 *.* LISTEN
$ ~export http_proxy='http://localhost:8118'
$ ~export https_proxy='http://localhost:8118'
$ ~curl ip.gs
2. git clone https://github.com/CocoaPods/Specs.git 仍然失败。
备注:https://github.com/CocoaPods/Specs.git执着于默认链接是因为好多网上推荐的国内镜像源要么打不开,要么不更新。
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
文件太大,下载不下来。
试了网上说的
$ git config --global http.postBuffer 2048576000
not work
又试了网上说的
$ git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master --depth 1
$ git fetch --unshallow
第二步失败,还是报错 error: RPC failed; curl 18 transfer closed with outstanding read data remaining
第二步拉取的东西还是太大,拉不下来。
最后找到一个好的方式,git 分片拉取。目前看来works.
$ git config --global core.compression 0
$ git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master --depth
$ cd ~/.cocoapods/repos/master
$ git fetch --depth=5
$ git fetch --depth=100
$ git fetch --depth=300
。。。
数值一步步试探,慢慢加大,过大就会出现同样的错误curl18,增量调小,继续试探
最后
$ git fetch --depth=350000
$ git fetch --unshallow
fatal: --unshallow on a complete repository does not make sense
这个就是成功了
附上参考链接
http://gci2017fossasia.blogspot.com/2017/11/how-to-clone-biggest-repositories.html
3.➜ master git:(master) pod search WechatOpenSDK
[!] Unable to find a pod with name, author, summary, or description matching `WechatOpenSDK`
还是搜不到,需要把旧的搜索索引文件删除
rm ~/Library/Caches/CocoaPods/search_index.json
➜ master git:(master)pod search WechatOpenSDK
Creating search index for spec repo 'master'.. Done!
成功搜索