【发布时间】:2020-10-16 23:55:25
【问题描述】:
我正在尝试将 Gerrit 和 Jenkins 迁移到新的数据中心。我已经在他们的新硬件上成功安装了这些应用程序,但是让 Jenkins 从同一服务器上的 Gerrit 存储库读取数据时遇到了困难。
由于 Jenkins 用户已经存在于服务器上,我使用以下命令更新了其 ssh 密钥,该密钥是我从笔记本电脑上的帐户 (pablo@mena-xps) 生成的:
cat ~/.ssh/id_rsa.pub | ssh -p 29418 pmena@gerrit_host gerrit set-account --add-ssh-key - jenkins
我确认我可以使用此密钥从我的笔记本电脑上询问 gerrit:
pablo@mena-xps=> ssh -p 29418 pmena@gerrit_host gerrit version
gerrit version 2.10
在 Jenkins 服务器上,我在“凭据”下添加了私钥,然后将特定作业配置为使用该密钥访问特定的 gerrit 存储库。这会在 GUI 中返回以下错误:
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://gerrit_host:29418/my_repo HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
如何解决此问题?提前谢谢你。
【问题讨论】: