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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2370371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:03:09  来源:igfitidea点击:

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

windowsgithudsonclone

提问by Lewis

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. Git/binis on the path. However I cannot clone the repository. Here is a shortened display of the console output:

我在 Windows 服务器上安装了带有 git 插件的 Hudson(不是我的选择)并且 Hudson 作为服务运行。Git/bin正在路上。但是我无法克隆存储库。这是控制台输出的简短显示:

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? or
  • b) connect to the remove computer with the same user account as hudson uses as to allow hudson to fetch?
  • a) 如何更改 hudson 的运行用户?或者
  • 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

刘易斯

回答by VonC

This may be related to the question Git, Can't clone repo on windows

这可能与Git, Can't clone repo on windows的问题有关

The problem is that MSysGit starts PLink in the background, i.e. the terminal is not actually connected to the input of PLink. That means that you simply can't type anything into 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.

问题是MSysGit在后台启动PLink,即终端实际上​​并没有连接到PLink的输入端。这意味着您根本无法在 PLink 中输入任何内容。

您只需要使用 PLink 或 PuTTY 连接到服务器一次,回答是,从那时起,您将不会再被询问。

The tutorialfrom cletuscan be helpful as well.

教程克莱能有帮助。

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".

The next step is to add the trace manually the cache (a file) because I know you can do in Linux.
Wrong again, Windows does not have this cache as a file but uses the registry.
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.

The entry goes like this:

问题是Hudson 是一项服务,并在用户“本地服务帐户”下运行

下一步是手动添加跟踪缓存(一个文件),因为我知道你可以在 Linux 中这样做。
再次错误,Windows 没有将此缓存作为文件,而是使用注册表。
在寄存器中搜索找到了我的用户(之前访问过存储库并添加到缓存足迹)的条目,其中存储跟踪并复制到 HKEY_USERS 以便用户可以访问它。

条目是这样的:

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,作为服务运行,愉快而顺利地转到代码所在的存储库。

回答by TheDon

The 'started by anonymous' is telling you which Hudson user started the job. If you haven't created any Hudson users, then everything is started by 'anonymous'

“由匿名开始”告诉您哪个 Hudson 用户开始了这项工作。如果您还没有创建任何 Hudson 用户,那么一切都由“匿名”开始

It is not related to which OS user is executing the process.

它与哪个操作系统用户正在执行该进程无关。

回答by Guildencrantz

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. 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. My recommendation is that you simply set the CYGWIN environment variable to empty in Hudson.

设置帐户后,我确保 git 服务器位于 MINGW(Git Bash)的 ~hudson/.ssh/known_hosts 中,并且有一个 ~hudson/.ssh/identity 文件。我唯一的警告是,如果您在盒子上安装了 cygwin,您需要确保 %CYGWIN% 为空,否则您将在 Hudson 日志中看到关键权限错误。我的建议是您只需将 Hudson 中的 CYGWIN 环境变量设置为空。

回答by Larry Cai

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,但它应该是一样的