在配置在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.我可以使用Putty连接到git服务器。
此外,我还可以使用Netbeans或命令行克隆git存储库。
.ssh文件夹权限为700,known_hosts文件权限为644
发布于 2017-08-30 20:58:31
(命令"/usr/bin/git -c core.askpass=true ls-remote -h ssh://-h@ip addres:2020/opt/gitrepo/enpapp.git HEAD")
从您的日志中可以看出,Jenkins正在尝试使用ssh-key连接到服务器
您可以使用ssh-keygen生成正确的密钥,并将私钥添加到Jenkins凭证中,将公钥添加到您的服务器帐户中。
如果你能分享你的jenkins工作的截图,显示它是如何配置的,那就更好了。Jenkins中的Git插件在ssh上不支持用户名和密码。
发布于 2020-06-06 05:25:15
我也有同样的问题。在我的例子中,我错误地将私钥粘贴到了Jenkins中。我删除了私钥的第一部分和最后一部分
-----BEGIN OPENSSH PRIVATE KEY----- &-----END OPENSSH PRIVATE KEY-----因此,请确保在Jenkins上创建SSH凭据字段时复制了私钥的所有内容。
https://stackoverflow.com/questions/29204838
复制相似问题