问题描述:
1 cocoa pods 更换源 执行pod install
出现 :[!] Unable to add a source with url https://github.com/CocoaPods/Specs.git
named master
.
You can try adding it manually in ~/.cocoapods/repos
or via pod repo add
.
2 执行 pod repo add master https://git.coding.net/CocoaPods/Specs.git
出现:[!] To setup the master specs repo, please run pod setup
.
解决方法:https://github.com/CocoaPods/CocoaPods/issues/4989
Got a temp workaround! Tested with my app and everything is working. This is really only needed if you deleted the master repo. If the master folder is still in your ~/.cocoapods/repos
folder with contents then you should be ok to just use pod install --no-repo-update
.
- Try doing a
pod setup
. This should at minimum download the.git
to~/.cocoapods/repos/master
- While this is going, you need to move the
.git
folder from the master folder to somewhere temporary. - Stop the pod setup. Delete master folder in repos
- Use the wget command below to get the zip of the repo wget https://github.com/CocoaPods/Specs/archive/master.zip
- Unzip the master zip and move its contents to
~/.cocoapods/repos/master
- Move your
.git
folder from wherever you put it to~/.cocoapods/repos/master
as.git
- Go to your project folder, do a
pod install --no-repo-update
And you should be good to go!
So in short, here is the basic list of commands I used:
pod setup (in a separate tab)//打开另一个终端执行pod setup 不要关闭
mv ~/.cocoapods/repos/master/.git ~/tempSpecsGitFolder//回到第一个终端 得到.git文件
^C on pod setup tab//按住ctrl+C 退出
wget https://github.com/CocoaPods/Specs/archive/master.zip//wget下载master.zip
open master.zip (unzipping it)//解压
mv Specs-master ~/.cocoapods/repos/master//修改名称为master
mv ~/tempSpecsGitFolder ~/.cocoapods/repos/master/.git//因为master里面没有.git文件 所以把刚才通过pod setup 生成的.git 文件移过来
cd [project folder]//切换到工程目录
pod install --no-repo-update//执行pod install
还能写东西吗