很久没跑ios项目,今天pod Install报这个错,记录一下
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
# 过了很久很久没反应
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`.
You can try adding it manually in `/Users/xxx/.cocoapods/repos` or via `pod repo add`.
1,解决方案
cd ~/.cocoapods/repos/
检查一下 master 文件夹是否存在,如果存在 master 文件夹,执行 pod repo remove master。不存在则跳过这一条命令。
pod repo remove master
接下来继续执行以下命令
pod setup
git clone --depth 1 https://github.com/CocoaPods/Specs.git master
如果失败,尝试科学上网。
此时应该已经解决问题了。
2,切换远程分支参考:解决git clone过大的仓库_csdnwr的博客-优快云博客_gitlab远程仓库太大
git remote set-branches origin '*'