DevelopmentiOS

[!] Unable to add a source with

2020-04-21  本文已影响0人  survivorsfyh

对项目执行 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/fyhsurvivors/.cocoapods/repos` or via `pod repo add`.

解决办法

首先,因 CocoaPods 的库文件较大 https://github.com/CocoaPods/Specs.git 的方式很容易中断,建议尝试切换为 ssh 的方式进行 clone 操作 git@github.com:CocoaPods/Specs.git

其次,终端中输入如下命令,处理 cocoapods 的 repos;

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

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

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

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

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: RPC failed; curl 18 transfer closed with outstanding read data remaining - Dev


以上便是此次分享的全部内容,希望能对大家有所帮助!

上一篇 下一篇

猜你喜欢

热点阅读