我似乎在尝试将Jenkins(Ubuntu的EC2 AWS实例)与Bitbucket链接时陷入困境。
每当我尝试构建项目时(我在Jenkins上安装了git插件),我都会得到…
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 git@bitbucket.org:DAVID99WORLD/assessme.git hudson.plugins.git.GitException: Could not clone 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.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 git@bitbucket.org: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
很好- 看起来它正在尝试通过ssh,但是找不到密钥。所以我试图生成密钥,在~/.ssh我有文件的情况下authorized_keys,known_hosts但是根据这里的文档…
~/.ssh
authorized_keys
known_hosts
https://confluence.atlassian.com/display/BITBUCKET/How+to+install+a+public+key+on+your+bitbucket+account
我应该在〜/ .ssh下有一个名为id_rsa的文件
我一直在关注文档…
https://confluence.atlassian.com/display/BITBUCKET/使用+ the + SSH + protocol + with + bitbucket
但是它看起来几乎完成了一半,或者我缺少将密钥放入正确文件中的位。
首先-我的假设正确吗,这是一个ssh问题?其次,如果是这样,有谁知道如何获得匹配的钥匙,以便詹金斯能够进行拉拔和建造?
编辑:我认为这是一个ssh问题,因为詹金斯(Jenkins)使用带有部署密钥的Git进行构建是相关的,但是我使用的是bitbucket而不是github。
您需要生成密钥文件以上传到您的BitBucket帐户。从运行Jenkins的用户执行以下操作:
ssh-keygen -t rsa
使用密钥文件位置的默认值,并将密码短语留空。然后,您将有〜/ .ssh / id_rsa.pub文件上传到BitBucket。