简体   繁体   English

在Windows上使用Hudson的Git插件克隆/获取存储库的问题

[英]Problem cloning / fetching repository using Git plugin for Hudson on Windows

Before anybody shoots me down for this - I have already checked every appropriate thread and still not found a solution to my problem. 在任何人为此向我射击之前 - 我已经检查了每个合适的线程,但仍未找到解决我问题的方法。

I have Hudson with git plugin installed on windows server (not my choice) and Hudson runs as a service. 我在Windows服务器上安装了gud插件的Hudson(不是我的选择),Hudson作为服务运行。 Git/bin is on the path. Git/bin就在路上。 However I cannot clone the repository. 但是我无法克隆存储库。 Here is a shortened display of the console output: 这是控制台输出的缩短显示:

Started by user anonymous
Checkout:workspace / C:\.hudson\jobs\sdf\workspace - hudson.remoting.LocalChannel@65394b
Last Built Revision: Revision 74200b32314231a5efdadd87bf36b42ec145c720 (origin/master)
Checkout:workspace / C:\.hudson\jobs\sdf\workspace - hudson.remoting.LocalChannel@65394b
Fetching changes from the remote Git repository
Fetching upstream changes from ssh://git.mccannlondon.co.uk/git/mccann_admin
[workspace] $ "C:\Program Files\Git\bin\git.exe" fetch -t ssh://git.mccannlondon.co.uk/git/mccann_admin +refs/heads/*:refs/remotes/origin/*
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 f1:48:2a:0a:d9:18:cf:2e:f2:8c:b3:25:7f:34:d5:34
Connection abandoned.
fatal: The remote end hung up unexpectedly
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway

So it seems I need to authenticate the host however I'm not sure why hudson is starting the job as user anonymous when I have set the Administrator as owner of the hudson service. 因此,我似乎需要对主机进行身份验证,但是当我将管理员设置为hudson服务的所有者时,我不确定为什么hudson以匿名用户身份启动工作。

Does anyone know: 有人知道吗:

  • a) how to change hudson's run user? a)如何改变哈德森的用户? or 要么
  • b) connect to the remove computer with the same user account as hudson uses as to allow hudson to fetch? b)使用与hudson使用相同的用户帐户连接到删除计算机以允许hudson获取?

If this has been posted before apologies but I spent a good few hours searching around and couldn't find anything. 如果这是在道歉之前发布的,但我花了几个小时搜索周围,找不到任何东西。

Thanks 谢谢

Lewis 刘易斯

This may be related to the question Git, Can't clone repo on windows 这可能与Git问题有关,无法在Windows上克隆回购

The problem is that MSysGit starts PLink in the background, ie the terminal is not actually connected to the input of PLink. 问题是MSysGit在后台启动PLink,即终端实际上​​没有连接到PLink的输入。 That means that you simply can't type anything into PLink. 这意味着你根本无法在PLink中输入任何内容。

You simply have to connect to the server once using PLink or PuTTY, answer Yes and from then on, you won't be asked again. 您只需使用PLink或PuTTY连接到服务器一次,回答是,从那时起,您将不会再被询问。

The tutorial from cletus can be helpful as well. cletus教程也很有帮助。

A good description of the issue can be found in this blog entry 可以在此博客条目中找到有关该问题的详细说明

the problem is that Hudson is a service and runs under the user "Local Service Account" . 问题是Hudson是一个服务,并在用户“本地服务帐户”下运行

The next step is to add the trace manually the cache (a file) because I know you can do in Linux. 下一步是手动添加跟踪缓存(文件),因为我知道你可以在Linux中做。
Wrong again, Windows does not have this cache as a file but uses the registry. 错误的是,Windows没有此缓存作为文件,但使用注册表。
Searching in the register found an entry for my user (who had previously accessed the repository and added to the cache footprint) where the trace was stored and copied to HKEY_USERS so that users can access it. 在寄存器中搜索时,为我的用户(以前访问过存储库并添加到缓存占用空间中)找到了一个条目,其中存储了跟踪并将其复制到HKEY_USERS,以便用户可以访问它。

The entry goes like this: 条目是这样的:

Key Name: HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys
Class Name: NO CLASS
Last Write Time: 23.01.2009 - 18:35
Value 0
Name: dss@22:bla_bla.com
Type: REG_SZ
Data: 0xb477b...

From the command line, you can easily add the key as follows: 从命令行,您可以轻松添加密钥,如下所示:

reg add HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys /v dss@22:bla_bla.com /d 0xb477b...

Now Hudson, run as a service, go happily and smoothly to the repository where the code. 现在Hudson作为一项服务运行,愉快而顺利地进入代码库。

The 'started by anonymous' is telling you which Hudson user started the job. '匿名启动'告诉你哪个Hudson用户开始工作。 If you haven't created any Hudson users, then everything is started by 'anonymous' 如果你还没有创建任何Hudson用户,那么一切都是由'anonymous'启动的

It is not related to which OS user is executing the process. 它与哪个OS用户正在执行该过程无关。

You asked how to change the user that Hudson runs as: you need to edit the service (Control Panel->Administrative Tools->Services, double click the Hudson service and change the "Log On" to "This account"). 您询问如何更改Hudson运行的用户:您需要编辑服务(控制面板 - >管理工具 - >服务,双击Hudson服务并将“登录”更改为“此帐户”)。

Once the account is setup I make sure that the git server is in MINGW's (Git Bash's) ~hudson/.ssh/known_hosts, and that there's a ~hudson/.ssh/identity file in place. 一旦设置了帐户,我确保git服务器在MINGW(Git Bash)~hudson / .ssh / known_hosts中,并且有一个~hudson / .ssh / identity文件。 The only warning I have is that if you have cygwin installed on the box you need to make sure that %CYGWIN% is empty, otherwise you'll see key permission errors in the Hudson logs. 我唯一的警告是,如果您在盒子上安装了cygwin,则需要确保%CYGWIN%为空,否则您将在Hudson日志中看到密钥权限错误。 My recommendation is that you simply set the CYGWIN environment variable to empty in Hudson. 我的建议是你只需在Hudson中将CYGWIN环境变量设置为空。

I meet the same problem and after check git plugin, http://wiki.hudson-ci.org/display/HUDSON/Git+Plugin 我遇到同样的问题,经过检查git插件, http://wiki.hudson-ci.org/display/HUDSON/Git+Plugin

It is stated to change the git path to /usr/bin/git in Global setting and config the git username 据说在全局设置中将git路径更改为/ usr / bin / git并配置git用户名

And it fixes my problem 它解决了我的问题

Hope it works for you as well, by the way, I use ubuntu, but it should be the same 希望它也适合你,顺便说一下,我使用ubuntu,但它应该是一样的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM