xcode Cocoapods - 指定源代码库用户名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26546796/
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
Cocoapods - Specify Source Repo Username
提问by Brian Boyle
Using Cocoapods v0.34.4
使用 Cocoapods v0.34.4
My Podfile contains the following
我的 Podfile 包含以下内容
source 'https://bitbucket.org/MyRepo/My-podspecs.git'
source 'https://github.com/CocoaPods/Specs.git'
When I run pod installI need to specify a username/password for my bitbucket account. This is fine when I am running locally, however I am also running this as part of a Continuous Integration build with XCode Server and XCode 6. On XCode Server the pod installcommand fails because it cannot access bitbucket without my credentials.
当我运行pod install 时,我需要为我的 bitbucket 帐户指定一个用户名/密码。当我在本地运行时,这很好,但是我也在使用 XCode 服务器和 XCode 6 作为持续集成构建的一部分运行它。在 XCode 服务器上,pod install命令失败,因为它无法在没有我的凭据的情况下访问 bitbucket。
Is it possible to add my credentials to the Podfile or any other way to tell Cocoapods the credentials for the bitbucket source repo?
是否可以将我的凭据添加到 Podfile 或以任何其他方式告诉 Cocoapods bitbucket 源存储库的凭据?
回答by sgvd
You can use the Bitbucket SSH URL instead of the https URL, and set up passwordless SSH by using an SSH key.
您可以使用 Bitbucket SSH URL 代替 https URL,并使用 SSH 密钥设置无密码 SSH。
Change your Podfile:
更改您的 Podfile:
source '[email protected]:MyRepo/My-podspecs.git'
And follow BitBucket's instructions hereto set up an SSH key and add it to your Bitbucket account. Make sure you give an empty password when creating your key/identity. For instance, in step 3.4 of their instructions for OSX/Linux, just press enter
twice.
并按照此处BitBucket 的说明设置 SSH 密钥并将其添加到您的 Bitbucket 帐户。确保在创建密钥/身份时提供空密码。例如,在他们针对 OSX/Linux 的说明的第 3.4 步中,只需按enter
两次即可。