简体   繁体   English

Jenkins 服务无法使用 SSH 访问 GIt 存储库

[英]Jenkins Service Cannot access GIt repository Ussing SSH

I have installed Jenkins on remote server (ubuntu) and created a project.我已经在远程服务器(ubuntu)上安装了 Jenkins 并创建了一个项目。 ( https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-16-04 ) ( https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-16-04 )

Then I created key pair using ssh-keygen and added public key to the bitbucket project.然后我使用ssh-keygen创建了密钥对并将公钥添加到 bitbucket 项目中。 ( https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html ) Now there is a capability to execute git commands on terminal of remote server such as git clone . ( https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html ) 现在可以在远程服务器的终端上执行 git 命令,例如git clone and it works fine.它工作正常。

But the problem is when I add git repository to the jenkins Source Code Management section it shows an error of permission denied.但问题是当我将 git 存储库添加到 jenkins源代码管理部分时,它显示权限被拒绝的错误。 Can anyone explain how can I set git repository on jenkin'ssource code management section correctly.谁能解释我如何在jenkin 的源代码管理部分正确设置 git 存储库。 I have added a SS of the error message.我已经添加了错误消息的 SS。

错误截图

The error points to the host key missing in known_hosts file.该错误指向 known_hosts 文件中缺少主机密钥。 Login to the jenkins server as user 'jenkins'.以用户“jenkins”的身份登录到 jenkins 服务器。 Checkout you repo using ssh url, you will see a SSH warning when connecting to a new host for first time.使用 ssh url 签出您的 repo,您​​将在第一次连接到新主机时看到 SSH 警告。 Enter yes.输入是。 The host key for bitbucket.org will now be added to the ~/.ssh/known_hosts file bitbucket.org 的主机密钥现在将添加到 ~/.ssh/known_hosts 文件中

That should resolve the error you are seeing这应该可以解决您看到的错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM