1. 問題
最近在同事電腦上執(zhí)行 pod install 會出現(xiàn)不響應(yīng)的情況。
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
# 過了很久很久沒反應(yīng)
[!] 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 文件夾,執(zhí)行 pod repo remove master。不存在則跳過這一條命令。
pod repo remove master
接下來繼續(xù)執(zhí)行以下命令
pod setup
git clone --depth 1 https://github.com/CocoaPods/Specs.git master
此時應(yīng)該已經(jīng)解決了。
3. 其他報錯情況
如果執(zhí)行第二步后仍有以下報錯。(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
執(zhí)行以下命令
git config --global http.postBuffer 524288000
4. 追蹤遠程分支
git remote set-branches origin '*'