ios - git:致命:克隆私有(private) Cocoapod 时无法从远程存储库读取

标签 ios git cocoapods travis-ci

我第一次尝试在 Travis-CI 上设置 iOS 项目,但在让 travis 添加私有(private) pod-spec 存储库时遇到问题。

我有一个运行此命令的前脚本:

- gem install cocoapods
- pod repo add MyPrivate-Repo <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7b0bea397b0bea3bfa2b5f9b4b8ba" rel="noreferrer noopener nofollow">[email protected]</a>:myAccount/MyPrivate-Repo.git
...

但是,当 travis 尝试添加我的私有(private) pod 规范存储库时,我收到此错误

Cloning spec repo `MyPrivate-Repo` from `<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8fe8e6fbcfe8e6fbe7faeda1ece0e2" rel="noreferrer noopener nofollow">[email protected]</a>:myAccount/MyPrivate-Repo.git`

[!] Pod::Executable clone '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="44232d3004232d302c31266a272b29" rel="noreferrer noopener nofollow">[email protected]</a>:myAccount/MyPrivate-Repo.git' MyPrivate-Repo

Cloning into 'MyPrivate-Repo'...

ERROR: Repository not found.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

现在我对此很陌生,所以如果我在这里遗漏了一些明显的东西,我深表歉意。

我确信该存储库确实存在,我通过执行

进行了测试
git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d4a44596d4a445945584f034e4240" rel="noreferrer noopener nofollow">[email protected]</a>:myAccount/MyPrivate-Repo.git

在我的本地计算机上。所以这意味着我假设的访问权限。我该如何检查其访问权限? Travis 似乎可以很好地克隆同一组织内的其他存储库?非常感谢任何帮助!!

最佳答案

它可以在您的计算机上运行,​​因为 ssh 知道您在哪里查找您的公共(public)/私有(private) ssh key 。

但是您需要将这些 key (或者更好的是,添加专用于您的 travis 配置的新公共(public)/ssh key )到 Travis,以便该环境能够验证并访问您的私有(private)存储库。

参见Pushing to github from travis-ci .

请注意,您可以使用 travis encrypt.travis.yml 文件中,如 this gist来自Luke Patterson (lukewpatterson) .

To encrypt the private SSH key into the "-secure: xxxxx....." lines to place in the .travis.yml file, generate a deploy key then run: (to see what the encrypted data looks like, see an example in this .travis.yml.

base64 --wrap=0 ~/.ssh/id_rsa > ~/.ssh/id_rsa_base64
ENCRYPTION_FILTER="echo \$(echo \"-\")\$(travis encrypt veewee-community/veewee-push \"\$FILE='\`cat $FILE\`'\" | grep secure:)"
split --bytes=100 --numeric-suffixes --suffix-length=2 --filter="$ENCRYPTION_FILTER" ~/.ssh/id_rsa_base64 id_rsa_

Ha! it takes 30 lines to squeeze it all in.

这给出了类似的东西:

env:
  global:
    - secure: "Y3Ox1GnYemOXPms5qUg//pnJBTh/9/kdnDa8BRXqurMaH6RuADcZnmSLjR7W\ny81/JuXMgToWN/+6zZALZyoYm87qRjjQAKfglA9nuSeXDSPhpERMXaf7RVUI\n8BpQYkmdY/HsQtGci4qqNfifQulp8TS/CpV+Kgx9k5JpulBeFow="
    - secure: "ePKK/XhvRqBiHKFPZdh5rGgupABVQyYUQWvl2uzfqgCRZ6xGIU+ZW89iiL27\n3cSfEL1x1FAXPkpslNOscz4INYgl8+dUvnmwnSuT2b/9ekpeDEhTmC+L06si\n15NLKCK7TUnS3wJ/WkA27ij43X+ArOqsTi2xvTXTPdn4utLjfIM="
    - secure: "C...
    ...
    ...

To reconstitute the private SSH key once running inside Travis: (see example use in this .travis.yml)


另一种类似的技术in this gist来自Douglas Duteil (douglasduteil) ,它在 .travis.yml 中声明一个外部脚本。

before_script: .travis/before_script.sh



echo -n $id_rsa_{00..30} >> ~/.ssh/id_rsa_base64
base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config

关于ios - git:致命:克隆私有(private) Cocoapod 时无法从远程存储库读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24271379/

相关文章:

ios - 控制台错误 : Invalid Firebase Data setvalue cannot store object

ios - UIASlider 不滑动

ios - ContainerView 添加导出

git - 使用 GitHub 作为托管 Drupal 站点的版本控制工具

git - Git 远程推送的最佳实践

ios - 当我调用 defaultRealm 时应用程序崩溃

ios - Twitter 登录问题 Parse.com iOS

reactjs - Visual Studio Code [eslint] 在 windows 上删除 'CR' [prettier/prettier]

swift - 使用 CocoaPods 和 xcode 6.3 的 Alamofire

objective-c - 将 Objective-C pod 作为依赖项导入到 Swift pod 中