Jenkins权限被拒绝(publickey,gssapi-keyex,gssapi-with-mic,密码)

Kri*_*hna 8 git ssh jenkins

在CentOS服务器上配置的Jenkins上,我尝试使用用户名和密码连接到另一台服务器上的git存储库.不幸的是我收到以下错误:

Failed to connect to repository : 
Command "/usr/bin/git -c core.askpass=true ls-remote -h ssh://root@[ip addres]:2020/opt/gitrepo/enpapp.git HEAD" 
returned status code 128:
stdout: 
stderr: Permission denied, please try again. 
Permission denied, please try again. 
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). 
fatal: Could not read from remote repository.*
Please make sure you have the correct access rights and the repository exists.
Run Code Online (Sandbox Code Playgroud)

我可以使用Putty连接到git服务器.
我也能够使用Netbeans或命令行克隆git存储库.

.ssh文件夹的权限是700,known_hosts文件是644

小智 0

(命令“/usr/bin/git -c core.askpass=true ls-remote -h ssh://root@[ip 地址]:2020/opt/gitrepo/enpapp.git HEAD”)

从您的日志中可以看出,Jenkins 正在尝试使用 ssh-keys 连接到服务器

您可以使用 ssh-keygen 生成正确的密钥,并将私钥添加到 Jenkins Credentials 中,将公钥添加到您的服务器帐户中。

如果您可以分享您的詹金斯作业的屏幕截图,显示它的配置方式,那就更好了。Jenkins 中的 Git 插件不支持 ssh 上的用户名和密码。
https://issues.jenkins-ci.org/browse/JENKINS-22909