【发布时间】:2017-10-30 14:34:40
【问题描述】:
我在存储库中有一个 Jenkins 管道,并且该存储库的 package.json 依赖于另一个存储库(两者都是 Bitbucket 私有存储库)。当我在本地进行 yarn install 时,它可以完美运行,但在 jenkins 中却因以下错误而失败:
yarn install v1.2.1
[1/5] Validating package.json...
[2/5] Resolving packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git@bitbucket.org/user/repo.git
Directory: /var/lib/jenkins/workspace/s_repo_branch-
YJRVO7LRN3U452ZV2XNZJUB35FGSW2NXEAUPBCDKUVTKUFAHHBDA
Output:
Permission denied (publickey).
fatal: Could not read from remote repository.
我在主机上添加了 ssh 密钥,添加为扫描组织文件夹的 jenkins 凭据(使用 Bitbucket 分支源插件),并在两个 bitbucket 项目中添加了密钥。另一个项目(没有依赖关系)的管道正常工作,所以我认为这不会是 ssh 密钥的问题。 package.json 中的依赖行如下所示:
"repo": "ssh://bitbucket.org/user/repo.git#develop"
也试过了
"repo": "git+ssh://bitbucket.org/user/repo.git#develop"
有人遇到过类似问题吗?
【问题讨论】:
标签: git ssh bitbucket jenkins-pipeline yarnpkg