我想添加到podfile私有git存储库,例如:
pod 'MyLibrary', :git => '[email protected] /cdn-cgi/l/email-protection:perfect/top-library.git', :branch => 'data/myLab'
但是当我运行“pod install”命令时,我收到错误:
[!] Error installing MyLibrary
[!] Failed to download 'MyLibrary'.
问题是如何将我的凭据从 git 提供给 cocoapods ?
如果您使用 SSH 并已生成 SSH 密钥(更多信息here https://help.github.com/articles/connecting-to-github-with-ssh/)
$>more ~/.ssh/config
它应该给你类似的东西:
Host SomeHostNameAlias
HostName github.com
User YourUserName
PreferredAuthentications publickey
IdentityFile /Users/YourLocalAccount/.ssh/TheSSHKeyGenerated
然后,在你的 Podfile 中,你应该能够做类似的事情(我没有把:branch =>
,但如果您需要它,还要注意我将其替换为:
with a /
替换主机后的路径。):
pod 'MyLibrary', :git => 'ssh://git@SomeHostNameAlias/perfect/top-library.git'
旁注:我在 Bitbucket 中使用了这种行为。我不是 SSH 和 GitHub 方面的专家,例如 git 路径可能会有一些小变化。
使用Host
像这样的别名还可以帮助您管理同一主机名的不同 SSH 密钥(例如同一 Git 服务器上的不同帐户/SSH),如果您管理不同的客户端、个人/工作访问等,则在 SourceTree 上可能很有用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)