Travis没有权限拉git(hub)子模块

时间:2015-09-25 06:23:29

标签: git github travis-ci

我属于github组织(作为协作者,不是所有者),我对两个私有存储库org/aorg/b具有读/写权限。 org/aorg/b上具有依赖关系(作为git子模块)。我想在travis中构建/测试org/a。我按照http://docs.travis-ci.com/user/private-dependencies/#Using-an-existing-key中的说明操作并使用了以下命令(ofc我将org/main替换为我的org/a):

$ travis sshkey --upload ~/.ssh/id_rsa -r org/main
Key description: Key to clone myorg/lib1 and myorg/lib2
updating ssh key for myorg/main with key from ~/.ssh/id_rsa
Current SSH key: Key to clone myorg/lib1 and myorg/lib2

org/a的travis设置中,我可以看到上传的SSH密钥,但是当我运行构建过程时,travis抛出错误,它无法访问pull org/b repo:

< S>
Installing an SSH key from: repository settings
Key fingerprint: 14:23:69:a0:27:c0:39:14:c2:81:71:af:2b:07:14:0a
$ git clone --depth=50 --branch=master git@github.com:org/b.git org/b
Cloning into 'org/b'...
Warning: Permanently added the RSA host key for IP address '192.34.272.118' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

我做错了什么?

编辑:我是瞎子。上传SSH密钥后travis不会在拉动git子模块时抛出错误,但在拉org/a(主)repo时(它应该构建的那个):

Installing an SSH key from: repository settings
    Key fingerprint: 14:23:69:a0:27:c0:39:14:c2:81:71:af:2b:07:14:0a
    $ git clone --depth=50 --branch=master git@github.com:org/a.git org/a
    Cloning into 'org/a'...
    Warning: Permanently added the RSA host key for IP address '192.34.272.118' to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.

编辑:我意识到在~/.ssh目录中我有其他的ssh键:

$ ls ~/.ssh
github_rsa  github_rsa.pub  id_rsa      id_rsa.pub  known_hosts

所以我想我应该上传github_rsa而不是id_rsa。但是,出于某种原因,我不记得密码短语github_rsa - 在这种情况下我该怎么办?

编辑:我刚刚将id_rsa.pub上传到我的github帐户,现在Travis成功地获取了主要回购(org/a),但它仍无权拉取git子模块:

Submodule 'b' (https://github.com/org/b.git) registered for path 'b'
$ git submodule update
Cloning into 'b'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/org/b.git/'
Clone of 'https://github.com/org/b.git' into submodule path 'b' failed

已解决:我正在使用HTTPS网址进行子模块 - &gt;将其更改为SSH(git@github.com:org / b.git)并且它有效。要更新子模块网址,只需修改.gitmodules文件,然后运行git submodule sync

0 个答案:

没有答案