本文介绍了用Bitbucket配置Jenkins的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将Jenkins(Ubuntu的一个EC2 AWS实例)与Bitbucket联系起来。



每当我尝试构建我的项目时在Jenkins上安装了git插件)我得到...

pre $ 构建在工作区/ var / lib / jenkins / jobs / Google adwords / workspace
签出:工作区/ var / lib / jenkins / jobs / Google adwords / workspace - hudson.remoting.LocalChannel@2c473996
使用策略:默认
克隆远程Git存储库
克隆存储库源
错误:克隆远程回购源错误:无法克隆[email protected]:DAVID99WORLD / assessme.git
hudson.plugins.git.GitException:无法克隆git @ bitbucket.org:DAVID99WORLD/assessme.git
at hudson.plugins.git.GitAPI.clone(GitAPI.java:268)
at hudson.plugins.git.GitSCM $ 2.invoke(GitSCM.java: 1122)
at hudson.plugins.git.GitSCM $ 2.invoke(GitSCM.java:1064)
at hudson.FilePath.act(FilePath.java:842)
at hudson.FilePath。法案(F ilePath.java:824)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
在hudson.model.AbstractBuild $ AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild $ AbstractBuildExecution.run (AbstractBuild.java:494)
at hudson.model.Run.execute(Run.java:1502)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
引起:hudson.plugins.git.GitException:命令 git clone --progress -o origin [email protected]:DAVID99WORLD / assessme.git / var / lib / jenkins / jobs / Google adwords / workspace返回状态码128:
stdout:克隆到'/ var / lib / jenkins / jobs / Google adwords / workspace'...

stderr:主机密钥验证失败。
致命:远程终端意外挂起

好的 - 这看起来好像正在尝试通过SSH,但无法找到密钥。所以我试图在〜/ .ssh 下生成密钥,我已经获得了 authorized_keys known_hosts 但根据这里的文档...



但看起来差不多完成了一半,或者我错过了将密钥放入正确文件的位。

首先 - 我的假设是否正确这是一个ssh问题?第二,如果是的话,有谁知道如何让钥匙匹配,所以詹金斯可以使拉和建立?编辑:我认为这是一个ssh问题相关,但是我使用bitbucket而不是github。

解决方案

您需要生成要上传到BitBucket帐户的密钥文件。从运行Jenkins的用户中,执行以下操作:

  ssh-keygen -t rsa 

采用密钥文件位置的默认值并将密码短语留空。然后您将有〜/ .ssh / id_rsa.pub文件上传到BitBucket。


I seem to have got stuck trying to link Jenkins (an EC2 AWS instance of Ubuntu) with Bitbucket.

Whenever I try to build my project (I've installed the git plugin on Jenkins) I get...

Building in workspace /var/lib/jenkins/jobs/Google adwords/workspace
Checkout:workspace / /var/lib/jenkins/jobs/Google adwords/workspace - hudson.remoting.LocalChannel@2c473996
Using strategy: Default
Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:DAVID99WORLD/assessme.git
hudson.plugins.git.GitException: Could not clone [email protected]:DAVID99WORLD/assessme.git
    at hudson.plugins.git.GitAPI.clone(GitAPI.java:268)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1122)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064)
    at hudson.FilePath.act(FilePath.java:842)
    at hudson.FilePath.act(FilePath.java:824)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
    at hudson.model.Run.execute(Run.java:1502)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Command "git clone --progress -o origin [email protected]:DAVID99WORLD/assessme.git /var/lib/jenkins/jobs/Google adwords/workspace" returned status code 128:
stdout: Cloning into '/var/lib/jenkins/jobs/Google adwords/workspace'...

stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly

Fine - this looks like it's trying to go over ssh but can't find the keys. So I'm trying to generate the keys, under ~/.ssh I've got the files authorized_keys and known_hosts but according to the documentation here...

https://confluence.atlassian.com/display/BITBUCKET/How+to+install+a+public+key+on+your+bitbucket+account

I should have a file under ~/.ssh called id_rsa

I've been following the documentation...

https://confluence.atlassian.com/display/BITBUCKET/Using+the+SSH+protocol+with+bitbucket

But it looks almost either half finished or I'm missing the bit where the key gets put in the correct file.

Firstly - is my assumption correct this is an ssh issue? Secondly, if it is, does anyone know how to get the keys to match so Jenkins can make the pull and build?

EDIT : I assumed it was an ssh issue as the question Jenkins Build Using Git with Deploy Key was related, but I'm using bitbucket rather than github.

解决方案

You need to generate the key file to upload to your BitBucket account. From the user that is running Jenkins, do the following:

ssh-keygen -t rsa

Take the default for the key file location and leave the passphrase blank. You'll then have the ~/.ssh/id_rsa.pub file to upload to BitBucket.

这篇关于用Bitbucket配置Jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:49