Hudson / Jenkins - 如何访问BitBucket.com上的私人git存储库 [英] Hudson/Jenkins -- how to access a private git repository on BitBucket.com

查看:168
本文介绍了Hudson / Jenkins - 如何访问BitBucket.com上的私人git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题很漫长而且多方面,所以我将从
简要概述开始,然后详细展示我尝试的所有内容以及我的
问题,以了解它们为什么不起作用以及我做错了什么。



概述



我试图在Hudson上设置一个Build Job BitBucket上的私人
存储库上的源代码。 Stack
Overflow上有很多类似的问题,但由于各种原因,它们都不符合我的需求。



我想用https访问它,而不是的ssh,但有
似乎没有办法使用https在Hudson中访问它,并且网上的每个
似乎都在ssh上销售。所以我试图让它与
ssh一起工作,但徒劳无功。




所以,我的核心问题是:
< b> 我如何访问Hudson中的私人
BitBucket存储库?



h2>




  • 我知道Jenkins更好, m与
    一起建立了Hudson服务器。请,没有关于切换到
    Jenkins的建议。
    我在标题中包含了Jenkins,并将其作为标记,因为更有可能比任何解决方案都不适用于两者。

  • 由于遇到了几个死胡同,我还要问几个子问题,详细说明$上面的核心问题b $ b - 如果你可以给我启发他们,请多加谢意。



问题



我使用Hudson的Git插件,并将其配置如下:



由于这是一个私有存储库,因此它需要以某种方式进行身份验证。所以当然,构建失败了。以下是堆栈跟踪的相关部分:

 错误:克隆远程回购'origin'时出错
hudson.plugins .git.GitException:
无法克隆https://TJamesBoone@bitbucket.org/OtherUser/projectname.git
导致:hudson.plugins.git.GitException:
org.eclipse。 jgit.api.errors.TransportException:
https://TJamesBoone@bitbucket.org/OtherUser/projectname.git:未授权

问题:为什么Hudson的Git插件没有在专用存储库的项目配置中进行身份验证的地方?毕竟,SVN插件可以处理认证。是否有一个很好的理由?

我试过的东西



我重新配置了项目以使用ssh url而不是https url:





然后,我使用
不要忘记设置一个EMPTY密码,因为詹金斯不支持它。
不要忘了先用jenkins用户登录,然后用 ssh git@bitbucket.org

我无法提供更多信息您的SSH案例,因为我没有在Windows上运行它。



如果这不起作用,请告诉我们是否:
* jenkins运行为一个服务
*如果不是,用于运行jenkins的web服务器是什么


This question is long and multifaceted, so I'll start with a brief overview, and then show in detail everything I've tried and my questions as to why they don't work and what I'm doing wrong.

Overview

I'm trying to setup a Build Job on Hudson for source code on a private repository on BitBucket. There are a lot of similar questions on Stack Overflow, but for various reasons none of them address my needs.

I would like to access it using https instead of ssh, but there seems no way forward accessing it in Hudson with https, and everyone on the web seems sold on ssh. So I have tried to make it work with ssh, but in vain.

So, my central question is:
How can I access a private BitBucket repository in Hudson?

Notes

  • I realize Jenkins is better, but I'm working with an established Hudson Server. Please, no advice about switching to Jenkins.
    I included Jenkins in the title and as a tag because more likely than not any solution will be applicable to both.
  • Due to running into several dead-ends, I also ask a couple of "sub-questions" that elaborate on the core question above -- extra gratitude if you can enlighten me on them.

The Problem

I use the Git plugin for Hudson, and configure it as follows:

Since this is a private repository, it needs authentication somehow. So of course, the build failed. Here are the relevant parts of the stack trace:

ERROR: Error cloning remote repo 'origin' 
hudson.plugins.git.GitException:
Could not clone https://TJamesBoone@bitbucket.org/OtherUser/projectname.git
Caused by: hudson.plugins.git.GitException:
org.eclipse.jgit.api.errors.TransportException:
https://TJamesBoone@bitbucket.org/OtherUser/projectname.git: not authorized

Question: Why does the Git Plugin for Hudson not have a place in the project configuration for authentication for private repositories? After all, the SVN plugin can deal with authentication. Is there a good reason?

Things I Tried

I reconfigured the project to use the ssh url instead of the https url:

I then created a ssh key using this tutorial from Atlassian. I then added the ssh key to the project on BitBucket.

I tried building again, and got this stack trace (relevant parts):

ERROR: Error cloning remote repo 'origin' 
hudson.plugins.git.GitException:
Could not clone git@bitbucket.org:OtherUser/projectname.git
Caused by: hudson.plugins.git.GitException:
org.eclipse.jgit.api.errors.TransportException:
git@bitbucket.org:OtherUser/projectname.git:
UnknownHostKey: bitbucket.org. RSA key fingerprint is
97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40

I then figured I should try to configure Hudson with the two ssh plugins that were available, the Publish Over SSH plugin and the SSH plugin (which I learned about here).

But I can't figure out how to use them. First, I assume I don't need the Publish Over SSH plugin, because I'm not trying to publish, I'm just trying to pull. Secondly, the SSH plugin won't work for me. I've tried doing this:

But the problem here is that it can't connect. Furthermore, it wants a port number, and if I enter in nothing, 22 is used as a default. I have no idea what to do with it.

Question: Do I even need to configure an SSH site in order to successfully put from this private BitBucket repository?

Summary

How can I access a private BitBucket repository in Hudson?

In my Hudson build, I need to be able to pull from this private BitBucket repository. I can't seem to make it work with ssh, and I don't even know if using https is possible as there's no place for me to put in a password. If someone can help me either way, I'll be happy.

解决方案

For HTTPS connection, you should define ALSO your password within the HTTPS query like :

https://TJamesBoone:**PASSWORD**@bitbucket.org/OtherUser/projectname.git

For SSH connection, as said, you should see that DOC : https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git Don't forget to setup an EMPTY passphrase as jenkins does not support it. Don't forget to login first with jenkins user to git using ssh git@bitbucket.org

I can't provide more info your SSH case as I'm not running it on windows.

If that is not working, please tell us if : * jenkins is runned as a service * if not, what is the webserver used to run jenkins

这篇关于Hudson / Jenkins - 如何访问BitBucket.com上的私人git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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