【问题标题】:git: fatal: Could not read from remote repository when cloning Private Cocoapodgit:致命:克隆私有 Cocoapod 时无法从远程存储库读取
【发布时间】:2014-08-07 21:54:01
【问题描述】:

我第一次尝试在 Travis-CI 上设置 iOS 项目,但我无法让 travis 添加私有 pod-spec 存储库。

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

- gem install cocoapods
- pod repo add MyPrivate-Repo git@github.com:myAccount/MyPrivate-Repo.git
...

但是,当 travis 尝试添加我的私有 pod 规范 repo 时,我收到此错误

Cloning spec repo `MyPrivate-Repo` from `git@github.com:myAccount/MyPrivate-Repo.git`

[!] Pod::Executable clone 'git@github.com: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 git@github.com:myAccount/MyPrivate-Repo.git

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

【问题讨论】:

    标签: ios git cocoapods travis-ci


    【解决方案1】:

    它可以在你的机器上运行,因为 ssh 知道你在哪里寻找你的公共/私人 ssh 密钥。

    但您需要向 Travis 添加这些密钥(或者,更好的是,添加一个专用于您的 travis 配置的新公钥/ssh 密钥),以便该环境能够验证和访问您的私有存储库。

    Pushing to github from travis-ci

    请注意,您可以在 .travis.yml 文件中使用 travis encrypt,就像在来自 Luke Patterson (lukewpatterson)this gist 中一样。

    要将私有 SSH 密钥加密到“-secure: xxxxx.....”行以放入 .travis.yml 文件中,请生成 部署密钥,然后运行:(查看加密数据的样子,请参阅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_
    

    哈!全部挤进去需要30行。

    这给出了类似的东西:

    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...
        ...
        ...
    

    在 Travis 中运行后重建私有 SSH 密钥:(参见示例,使用 in this .travis.yml


    来自Douglas Duteil (douglasduteil) 的另一个类似技术in this gist,它在.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
    

    【讨论】:

    • 同样的情况对我来说,但我没有使用任何 travis 只是尝试添加一个本地项目。如何解决?
    • @kidsid49 您可以创建一个新问题,并附上指向该问题的链接,解释差异,并详细说明您的设置(git 版本、操作系统、...)
    • @kidsid49 很好,但我没有看到任何有关您的设置、版本号或错误消息的信息。您需要发布一个完整的问题以供人们帮助您。
    • 对不起,伙计。刚刚编辑了我的答案。我发布了整个终端命令和输出。
    猜你喜欢
    • 2014-02-10
    • 2022-06-11
    • 2012-11-10
    • 1970-01-01
    • 1970-01-01
    • 2015-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多