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

Created on 5 Dec 2016  路  5Comments  路  Source: CocoaPods/CocoaPods

Hello, This error wasted a lot of time I need to find a solution.

  1. My Mac just install one Xcode, 8.1, Mac system is macOS Sierra 10.12.1
  2. And I tried
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

but it doesn't work....

  1. And I tried to uninstall cocoapods, reload cocoapods, when I execute pod install, the terminal will show this error again!
  2. final, the cocoapod is 1.1.1, I hope you can contact me as soon as possible, thanks!
awaiting validation

Most helpful comment

This should be fixed by running:

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

All 5 comments

This should be fixed by running:

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

Thank you for your reply!
when I git clone completion, then I execute pod setup , the terminal show :

Setting up CocoaPods master repo
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
[!] The `master` repo is not a git repo.

How should I fix this?

and I try to execute pod install again, still show this error :

Re-creating CocoaPods due to major version update.
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
Setting up CocoaPods master repo
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master-1`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

@SunnyLinSD There's no need to run pod setup when manually checking out the repo, however, it looks like you're running an outdated version of git. CocoaPods >= 1.1.0 requires 1.8.5 or newer and we added a better error for this on master.

DanToml's answer worked for me

DanToml's answer worked for me

Was this page helpful?
0 / 5 - 0 ratings