[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`.- Dev

/ Java / 没有评论 / 2181浏览

[!] Unable to add a source with url https://github.com/CocoaPods/Specs.git named cocoapods.- Dev

对项目执行 pod install 的时候遇到了如下异常: 1

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/fyhsurvivors/.cocoapods/repos` or via `pod repo add`.

解决办法

rm -rf ~/.cocoapods
mkdir -p ~/.cocoapods/repos
cd ~/.cocoapods/repos
git clone git@github.com:CocoaPods/Specs.git

注:如上操 clone 时对网络环境要求较高

若成功,则可以尝试在对应的项目中执行 pod install 即可 2

若失败,则会出现如下异常:

fyhsurvivors@survivors-deMacBook-Pro repos % git clone https://github.com/CocoaPods/Specs.git master
Cloning into 'master'...
remote: Enumerating objects: 402, done.
remote: Counting objects: 100% (402/402), done.
remote: Compressing objects: 100% (383/383), done.
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
error: rev-list died of signal 9
fatal: remote did not send all necessary objects

解决办法可详见 Error fetching https://gems.ruby-china.org/: bad response Not Found 404 - Dev 以上便是此次分享的全部内容,希望能对大家有所帮助!