1. 程式人生 > >iOS - 解決Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named

iOS - 解決Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named

轉載自:

https://www.cnblogs.com/hero11223/p/8882732.html

1  本來cocopods沒有問題,最近建立專案,利用cocopods匯入第三方庫的時候,出現如下錯誤:

[!] 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`.

解決方案:
pod repo add master https://github.com/CocoaPods/Specs.git
然後提示執行’pod setup’,如果出現
[!] The `master` repo is not a git repo.

然後進入 /users/你的使用者名稱/.cocoapods/repos,刪除master資料夾

然後執行:

pod setup


以上方法,親測有效!


其他提示報錯的話,一般都會有相應的提示,根據提示嘗試下即可!

2,[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress Cloning into 'master

解決方法如下:

   1 : 修改ruby源到https://ruby.taobao.org/ 

   2:升級gem sudo gem update --system 也是正常的

   3:安裝CocoaPods執行正常:sudo gem install -n /usr/local/bin cocoapods

   4:最後呼叫:pod setup