問題描述:
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
.
image
解決方法: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
還能寫東西嗎