Why I couldn't add the Git Url to my Jenkins?

廉价感情. 提交于 2019-12-20 02:15:10

问题


I'm very new to git and also Jenkins.

I added the ssh keys to the bitbucket and in my local machine, when I do :

git clone git@bitbucket.org:username/repo.git

I can be able to clone.

But when I add the same url (git@bitbucket.org:username/repo.git) to the Jenkins repository url I get an following error:

Failed to connect to repository : Command "git ls-remote -h git@bitbucket.org:username/repo.git HEAD" returned status code 128:
stdout: 
stderr:  Permission denied (publickey). 
fatal: The remote end hung up unexpectedly

回答1:


You need to set up the ssh keys for the Jenkins user too.

The general idea is that you log into the Jenkins box, and become the "jenkins" user. You could have called your Jenkins user anything, so make sure to use the right name. Once you're the Jenkins user, you can use ssh-keygen to create a new set of ssh keys. Then you can add them to your repo as deployment keys.

This might be useful too: Configuring Jenkins with Bitbucket



来源:https://stackoverflow.com/questions/13890500/why-i-couldnt-add-the-git-url-to-my-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!