xcode Pod 安装错误:[!]无法添加名为 master 的 url `https://github.com/CocoaPods/Specs.git` 的源

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40040352/
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-09-15 09:27:45  来源:igfitidea点击:

Pod installation error: [!]Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named master

iosxcodegitcordovagithub

提问by user2704095

I followed the steps on PhoneGap website and got stuck on the step using command "pod install" and got the error message as below:

我按照PhoneGap网站上的步骤操作,并使用命令“pod install”卡在了该步骤上,并收到如下错误消息:

MyMac:PhoneGapTest username$ pod install

Setting up CocoaPods master repo
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.gitnamed master.
You can try adding it manually in ~/.cocoapods/reposor via pod repo add.

MyMac:PhoneGapTest username$ pod install

设置 CocoaPods 主存储库
[!] 无法添加 urlhttps://github.com/CocoaPods/Specs.git名为的源master
您可以尝试在 中~/.cocoapods/repos或通过手动添加它pod repo add

Here is the information for my machine
1. Mac OS 10.12 Sierra
2. Xcode 8.0 (8A218a) [Setting in “Xcode/Peference/Locations/Command Line Tools” is set to “Xcode 8.0 (8A218a)”, path is “/Application/Xcode.app”]

这是我机器的信息
1. Mac OS 10.12 Sierra
2. Xcode 8.0 (8A218a) [在“Xcode/Peference/Locations/Command Line Tools”中设置为“Xcode 8.0 (8A218a)”,路径为“/Application /Xcode.app”]

Please suggest on how to resolve this. Thank you!

请建议如何解决这个问题。谢谢!

回答by atulkhatri

If you recently installed the latest version of XCodein your mac, I would suggest to have a look at the Preferencesonce.

如果你最近XCode在你的 mac 上安装了最新版本,我建议你看一下Preferences

Go to XCode => Preferences => Locationsand update the Command Line Toolslike this:

转到XCode => Preferences => Locations并更新Command Line Tools如下:

enter image description here

在此处输入图片说明

Now try pod updateand it will work like before.

现在尝试pod update,它会像以前一样工作。

回答by wei

I had this issue on my mac as well.

我的mac也有这个问题。

Please go to this link: https://github.com/CocoaPods/CocoaPods/issues/4293

请转到此链接:https: //github.com/CocoaPods/CocoaPods/issues/4293

I fixed this issue by doing the following:

我通过执行以下操作解决了这个问题:

  • cd to ~/.cocoapods/repos

  • Run git clone https://github.com/CocoaPods/Specs.git master

  • 光盘到 ~/.cocoapods/repos

  • git clone https://github.com/CocoaPods/Specs.git master

Tried update cocapods, re init pod and update repo, none of that works for me.

尝试更新 cocapods,重新初始化 pod 和更新 repo,这些都不适合我。

Hope it helps.

希望能帮助到你。

回答by user2704095

@Mohshin Shah, thanks a lot. You make my day! I stucked with this for two weeks. Your suggestion is the foundation to the workaround. Below are what I've done.

@Mohshin Shah,非常感谢。你让我开心!我坚持了两个星期。您的建议是解决方法的基础。下面是我所做的。

----------------- first try: using buffer size as given -------------------
My-Mac:PhoneGapTest username$ git config http.postBuffer 524288000
My-Mac:PhoneGapTest username$ pod install
Setting up CocoaPods master repo
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.gitnamed master.
You can try adding it manually in ~/.cocoapods/reposor via pod repo add.

----------------- second try: double the buffer size -------------------------
My-Mac:PhoneGapTest username$ git config http.postBuffer 1048576000
My-Mac:PhoneGapTest username$ pod install
Setting up CocoaPods master repo
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.gitnamed master.
You can try adding it manually in ~/.cocoapods/reposor via pod repo add.

----------------- 第一次尝试:使用给定的缓冲区大小 ------------------- ------ ----------- 第二次尝试:将缓冲区大小加倍 -------------------------
My-Mac:PhoneGapTest username$ git config http.postBuffer 524288000
My-Mac:PhoneGapTest username$ pod install
Setting up CocoaPods master repo
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.gitnamed master.
You can try adding it manually in ~/.cocoapods/reposor via pod repo add.


My-Mac:PhoneGapTest username$ git config http.postBuffer 1048576000
My-Mac:PhoneGapTest username$ pod install
Setting up CocoaPods master repo
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.gitnamed master.
You can try adding it manually in ~/.cocoapods/reposor via pod repo add.

----------------- third try: the workaround, note: this might also work with the given buffer size --------------
My-Mac:PhoneGapTest username$ git clone https://github.com/CocoaPods/Specs.gitmaster
Cloning into 'master'...
remote: Counting objects: 865802, done.
remote: Compressing objects: 100% (13060/13060), done.
remote: Total 865802 (delta 6507), reused 0 (delta 0), pack-reused 851785
Receiving objects: 100% (865802/865802), 348.54 MiB | 948.00 KiB/s, done.
Resolving deltas: 100% (375143/375143), done.
Checking connectivity... done.
Checking out files: 100% (114193/114193), done.

----------------- 第三次尝试:解决方法,注意:这也可能适用于给定的缓冲区大小 --------------
My-Mac:PhoneGapTest username$ git clone https://github.com/CocoaPods/Specs.gitmaster
Cloning into 'master'...
remote: Counting objects: 865802, done.
remote: Compressing objects: 100% (13060/13060), done.
remote: Total 865802 (delta 6507), reused 0 (delta 0), pack-reused 851785
Receiving objects: 100% (865802/865802), 348.54 MiB | 948.00 KiB/s, done.
Resolving deltas: 100% (375143/375143), done.
Checking connectivity... done.
Checking out files: 100% (114193/114193), done.

----------------- checking the result -------------------------
My-Mac:PhoneGapTest username$ ls
PhoneGapTest PhoneGapTestTests Podfile Pods
PhoneGapTest.xcodeproj PhoneGapTestUITests master

----------------- 检查结果 -------------------------
My-Mac:PhoneGapTest username$ ls
PhoneGapTest PhoneGapTestTests Podfile Pods
PhoneGapTest.xcodeproj PhoneGapTestUITests master

回答by Aymen BRAHAM

This should be fixed by running:

这应该通过运行来解决:

1)$ rm -rf ~/.cocoapods 2)$ mkdir -p ~/.cocoapods/repos 3)$ cd ~/.cocoapods/repos 4)$ git clone https://github.com/CocoaPods/Specs.gitmaster

1)$ rm -rf ~/.cocoapods 2)$ mkdir -p ~/.cocoapods/repos 3)$ cd ~/.cocoapods/repos 4)$ git clone https://github.com/CocoaPods/Specs.git掌握

回答by user8310082

This might be because 2 factor Authentication.You might have enabled the 2 Factor Authentication so your password is not the Github password now it is the password which is result of 2 factor authentication. You can get your password by

这可能是因为 2 因素身份验证。您可能启用了 2 因素身份验证,因此您的密码不是 Github 密码,现在它是 2 因素身份验证的结果的密码。您可以通过以下方式获取密码

opening Cmd+Space ->>Search for Keychain Access ->> Open KeyChain access ->> Click on search ->> search your username of Github ->> click on the Result of search ->> Click on show Password ->> Copy the password and paste it on terminal when it asks for password

打开Cmd+Space ->>搜索钥匙串访问->>打开钥匙串访问->>点击搜索->>搜索你的Github用户名->>点击搜索结果->>点击显示密码->>复制密码并在终端要求输入密码时将其粘贴到终端上