为什么我不能将Git Url添加到我的Jenkins? [英] Why I couldn't add the Git Url to my Jenkins?

查看:268
本文介绍了为什么我不能将Git Url添加到我的Jenkins?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对git和詹金斯都很陌生.

在执行此操作时,我将ssh键添加到了位桶和本地计算机中:

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

我可以克隆.

但是当我将相同的URL(git@bitbucket.org:username/repo.git)添加到Jenkins存储库URL时,出现以下错误:

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

解决方案

您还需要为Jenkins用户设置ssh密钥.

通常的想法是,您登录到Jenkins框,并成为"jenkins"用户.您可能已经给您的Jenkins用户打电话了,所以请确保使用正确的名称.一旦成为Jenkins用户,就可以使用ssh-keygen创建一组新的ssh密钥.然后,您可以将它们作为部署密钥添加到您的存储库中. /p>

这可能也很有用:使用Bitbucket配置Jenkins

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

解决方案

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

这篇关于为什么我不能将Git Url添加到我的Jenkins?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆