当我尝试设置一个从git存储库构建项目的作业时,出现了错误:
Failed to connect to repository : Command "git ls-remote -h ssh://git@ssh://git@host.com/path/to/repos.git HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
在 Jenkins 中,我安装了 SSH Agent 插件和 Git 插件。
我可以添加以下构建步骤:
git ls-remote -h ssh://git@host.com/path/to/repos.git HEAD
运行构建,一切正常!
这告诉我一切都设置正确:
- 密钥和密钥位置。
- Jenkins/Manage Jenkins/Manage Plugins -> SSH agent plugin 和 Git Plugin。
- Jenkins/Manage Jenkins/Manage Credentials 条目是正确的。
似乎这对于源代码管理不起作用,但对于预构建/构建/后构建操作可以。
是否存在 Ssh代理在构建过程之前没有被激活的问题?
提前感谢任何能够帮助的人。