我正在尝试通过 ssh 使用 Git 设置 jekins。
标准执行:
git clone ssh://[username]@[server]/srv/git/[repo]
将密码存储库克隆到我的磁盘上之后。
现在在 Jenkins
ssh://[username]@[server]/srv/git/[repo].git
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://[username]@[server]/srv/git/[repo].git HEAD" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
或者另一种方式是
最佳答案
您正在通过 SSH 进行连接,这可能意味着您已经设置了基于 key 的登录,这样您就可以在没有密码的情况下进行连接。 (将 ~/.ssh/id_rsa 移动到其他位置,我敢肯定,当您执行 git 克隆时,系统也会要求您输入密码。)
在这种情况下,错误是 Jenkins 没有类似私钥设置的结果。您必须为 jenkins 生成一对公钥/私钥,并将公钥添加到您的 git 服务器,或者将您的私钥添加到 Jenkins。
关于git - 通过 ssh 使用 git 设置 jenkins,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29792621/