【发布时间】: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 并让它执行它,它应该可以工作,但它没有。
【问题讨论】: