ios 无法添加带有 url 的源

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29301785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 05:23:16  来源:igfitidea点击:

Unable to add a source with url

iosiphoneios7ios5

提问by rajesh

[!] Unable to add a source with url [email protected]:CocoaPods/Specs.gitnamed master-1. You can try adding it manually in ~/.cocoapods/reposor via pod repo add. please any help

[!] 无法添加 url[email protected]:CocoaPods/Specs.git名为的源master-1。您可以尝试在 中~/.cocoapods/repos或通过手动添加它pod repo add。请任何帮助

回答by Jashu

Please follow this linkfor this problem. Its possible to forgott set your newly install Xcode path on command-line tool. Xcode-->Preferences-->Locations-->Command line tool --> set your Xcode.

请按照此链接解决此问题。可能忘记在命令行工具上设置新安装的 Xcode 路径。Xcode-->首选项-->位置-->命令行工具-->设置你的Xcode。

回答by Rainer Schwarze

You may need to reset your command line tools:

您可能需要重置命令行工具:

sudo xcode-select -r

I was receiving the same error message. Then I noticed, that the wrong Xcode environment was selected (it pointed to an old version which I deleted in the meantime). The command above resets it to the default command line path.

我收到了同样的错误信息。然后我注意到,选择了错误的 Xcode 环境(它指向我同时删除的旧版本)。上面的命令将其重置为默认的命令行路径。

Alternatively you might have no command line tools installed. In that case, download them from the Apple site and install them.

或者,您可能没有安装命令行工具。在这种情况下,请从 Apple 网站下载并安装它们。

回答by Tahir Iqbal

Go to ~/.cocoapods/repos and run git clone https://github.com/CocoaPods/Specs.gitmaster

转到 ~/.cocoapods/repos 并运行 git clone https://github.com/CocoaPods/Specs.gitmaster

回答by Anil Gupta

When you get above error it means, you didn't do the pod setup

当您遇到上述错误时,这意味着您没有进行pod 设置

instructions:

指示:

  1. First install the cocoapods in you Mac if it is not already installed. Use terminal.

    Xcode 7 + 8

    sudo gem install cocoapods --pre

    Xcode 7

    sudo gem install activesupport -v 4.2.6 sudo gem install cocoapods

  2. Set up the pod using command pod setup

  1. 如果尚未安装 cocoapods,请先在 Mac 中安装它。使用终端。

    Xcode 7 + 8

    sudo gem 安装 cocoapods --pre

    Xcode 7

    sudo gem install activesupport -v 4.2.6 sudo gem install cocoapods

  2. 使用命令pod setup 设置 pod

after doing these initial set up you are ready to make your project as work space project. You can follow these commands using terminal

完成这些初始设置后,您就可以将项目作为工作空间项目了。您可以使用终端执行这些命令

  1. Goto Project location folder : ~/Destop/SampleProject
  2. Create pod file : pod init
  3. List down your cocoa pods init it :

    # Uncomment the next line to define a global platform for your project
    #platform :ios, '9.0'
    
    target 'SampleProject' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!
    
    # Pods for SampleProject
    pod 'SlideMenuControllerSwift'
    
    
    target 'SampleProjectTests' do
     inherit! :search_paths
    # Pods for testing
    end
    
    target 'SampleProjectUITests' do
     inherit! :search_paths
     # Pods for testing
    end
    

    end

  1. 转到项目位置文件夹:~/Destop/SampleProject
  2. 创建 pod 文件:pod init
  3. 列出你的可可豆荚初始化它:

    # Uncomment the next line to define a global platform for your project
    #platform :ios, '9.0'
    
    target 'SampleProject' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!
    
    # Pods for SampleProject
    pod 'SlideMenuControllerSwift'
    
    
    target 'SampleProjectTests' do
     inherit! :search_paths
    # Pods for testing
    end
    
    target 'SampleProjectUITests' do
     inherit! :search_paths
     # Pods for testing
    end
    

    结尾

it will help you.

它会帮助你。

or else

要不然

After installation of cocoapods than you can download the cocoa master repo manually into Mac.

安装 cocoapods 后,您可以手动将 cocoa master repo 下载到 Mac 中。

    $ cd /Users/username/.cocoapods/repos 
    $ git clone https://github.com/CocoaPods/Specs.git master

回答by Kunal Gupta

I had the same problem , actually the problem was that command line was not able to find a path to my Xcode. Therefore the simplest solution that i found was to give a suitable location of xcode.

我遇到了同样的问题,实际上问题是命令行无法找到我的 Xcode 的路径。因此,我找到的最简单的解决方案是给 xcode 一个合适的位置。

For it:

为了它:

  1. Go to Xcode > Preferences
  2. Choose Location tab
  3. Select the Xcode in Command Line tools:- enter image description here
  1. 转到 Xcode > 首选项
  2. 选择位置选项卡
  3. 在命令行工具中选择 Xcode:- 在此处输入图片说明

thats it. I hope that works for you. All the best

就是这样。我希望这对你有用。祝一切顺利

回答by saurabh rathod

Please Follow this steps:

请按照以下步骤操作:

Open Terminal

打开终端

1] sudo xcode-select -r

1] 须藤 xcode-select -r

2] Xcode-->Preferences-->Locations-->Command line tool --> set your Current Xcode Version.

2] Xcode-->首选项-->位置-->命令行工具-->设置您当前的Xcode版本。

3] Edit Podfile and save

3]编辑Podfile并保存

4] pod install

4]吊舱安装

Thats it.

就是这样。

回答by 0xa6a

  1. $ cd /Users/username/.cocoapods/repos
  2. remove folder masterif it exists
    rm -rf master
    $ git clone https://github.com/CocoaPods/Specs.git master
  3. pod setup
  1. $ cd /Users/username/.cocoapods/repos
  2. 删除文件夹(master如果存在)
    rm -rf master
    $ git clone https://github.com/CocoaPods/Specs.git master
  3. pod setup

that's all.

就这样。

回答by Rahul Kavungal

This is often happening on initial pod install. I tried all and this steps helped me

这通常发生在初始 pod 安装时。我尝试了所有这些步骤对我有帮助

Please follow these steps:

请按照以下步骤操作:

1] pod repo update

1] pod 回购更新

2] pod install

2]吊舱安装

I hope that works for you. All the best

我希望这对你有用。祝一切顺利

回答by guozqzzu

Meet the same error and I have solved it by :

遇到同样的错误,我已经解决了:

1. Open your terminal
2. Go to the directory    : cd /User/YOUR_NAME/.cocoapods/repos/
3. remove the master file : rm -rf master
4. Clone the CocoaPods    : git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master

Note. I add the target path ~/.cocoapods/repos/masterto avoid the mistake that your current file path is not ~/.cocoapods/repos/master

笔记。我添加目标路径是~/.cocoapods/repos/master为了避免你当前文件路径不是的错误~/.cocoapods/repos/master

5. Run the setup          : pod setup 

回答by Alexander Stepanishin

I was getting the same error with only difference that there was different URL. I was trying to install private podsfrom private repository. What helped is to add ssh-keyto profile.

我得到了同样的错误,唯一的区别是有不同的URL. 我试图private pods从私人存储库安装。有帮助的是添加ssh-key到配置文件。

  1. Generate ssh-keyusing this guide: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/. Hope this helps.
  2. Add it in your profile settings on Bitbucket(or Github or whatever you are using)
  1. ssh-key使用本指南生成:https: //help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/。希望这可以帮助。
  2. 将它添加到 Bitbucket(或 Github 或您正在使用的任何东西)上的个人资料设置中