【问题标题】:Why am I unable to configure ssh keys to read a Gerrit repo from Jenkins?为什么我无法配置 ssh 密钥以从 Jenkins 读取 Gerrit 存储库?
【发布时间】: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.

如何解决此问题?提前谢谢你。

【问题讨论】:

    标签: jenkins ssh gerrit


    【解决方案1】:

    长话短说,这个问题已经解决了。 Gerrit 上的 Jenkins 账户被移除并重新创建,之后我能够成功推送 ssh 密钥对。

    【讨论】:

      猜你喜欢
      • 2017-03-29
      • 1970-01-01
      • 1970-01-01
      • 2021-07-26
      • 2019-07-19
      • 2018-08-02
      • 1970-01-01
      • 1970-01-01
      • 2016-06-11
      相关资源
      最近更新 更多