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

use*_*521 7 git github travis-ci

我属于github上的组织(如合作者,而不是所有者)和我已阅读两个私有仓库/写访问org/aorg/b.org/a有一个依赖(作为git子模块)org/b.我想org/a在travis中构建/测试.我按照http://docs.travis-ci.com/user/private-dependencies/#Using-an-existing-key中的说明使用了以下命令(ofc我替换org/main为my 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
Run Code Online (Sandbox Code Playgroud)

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

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.
Run Code Online (Sandbox Code Playgroud)

我做错了什么?


编辑:我是瞎子.上传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.
Run Code Online (Sandbox Code Playgroud)

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

$ ls ~/.ssh
github_rsa  github_rsa.pub  id_rsa      id_rsa.pub  known_hosts
Run Code Online (Sandbox Code Playgroud)

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


编辑:我刚刚上传id_rsa.pub到我的github帐户,现在Travis成功地拉出了主要的repo(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
Run Code Online (Sandbox Code Playgroud)

解决:我使用HTTPS url进行子模块 - >将其更改为SSH(git@github.com:org/b.git)并且它可以正常工作.要更新子模块URL,只需编辑.gitmodules文件然后运行git submodule sync