Pod Install 卡住报错

1. 问题

最近在同事电脑上执行 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`.

2. 解决方案

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

此时应该已经解决了。

3. 其他报错情况

如果执行第二步后仍有以下报错。(PS:我没实际遇到过,解决问题时找到别的帖子,顺手记录了下来)

error: RPC failed; curl 18 transfer closed with outstanding read data remaining 
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

执行以下命令

git config --global http.postBuffer 524288000

4. 追踪远程分支

git remote set-branches origin '*'
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容