【问题标题】:Jenkins and Bitbucket with SSH使用 SSH 的 Jenkins 和 Bitbucket
【发布时间】:2018-11-02 14:07:24
【问题描述】:

我在 jenkins 中创建了一个工作,它使用 ssh 密钥从 bitbucket 中的私有存储库中提取源代码。所以我不得不使用 PUTTY 进行设置,并将环境变量 GIT_SSH 设置为 plink 位置。因此,当我从命令行拉出时,它工作正常。现在,当我添加带有凭据的 bitbucket 存储库 URL 时,我在其中添加了私钥,在我点击保存之前,它会显示一条错误消息

Failed to connect to repository : Command "C:\Program Files\Git\bin\git.exe ls-remote -h repo link. return status code 128. tdout: 
stderr: Load key "C:\\Windows\\TEMP\\ssh2792596192881196946.key": invalid format
git@bitbucket.avlabs.us: Permission denied (publickey). 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我不确定它为什么会发出此消息。所以我想尝试另一种方法,我创建一个批处理文件来提取我的仓库。从命令行,它工作正常,但是当我将批处理文件添加到 Jenkins 作业时,它给出了一个错误:

git@bitbucket.avlabs.us: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我想既然它在命令行上工作,如果我只是将批处理文件的位置添加到 jenkins 并让它执行它,它应该可以工作,但它没有。

【问题讨论】:

    标签: git jenkins


    【解决方案1】:

    想通了,不得不去 Jenkins 上的 systemInfo,并检查 ssh 密钥是否是它们的主位置。找到它,它不在那里,它指向不同的位置,所以在 jenkins 主页位置添加两个键,它现在可以工作了。

    【讨论】:

      猜你喜欢
      • 2012-06-19
      • 1970-01-01
      • 2016-03-28
      • 1970-01-01
      • 2018-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多