Hudson+Git 克隆失败

发布于 2024-10-12 14:44:28 字数 2373 浏览 13 评论 0原文

我们在 Windows Server 2003 Enterprise 上使用 Git + OpenSSH 设置了 Hudson,并且运行良好一段时间。 然后突然间,它开始在克隆过程中以 12% 的速度挂起,我们怀疑文件可能变得太大了。 (它在所有其他计算机、Windows Server 2003 标准版、Windows 7 企业版上仍然可以正常工作),只有这一台服务器。

所以我们改用 Putty 而不是 OpenSSH,它可以在 gitBash 和 gitExtensions 上工作,但在 Hudson 上仍然失败。 因为我读到关于 plink 正确加载 ssh 密钥存在一些问题,所以我将 GIT_SSH 设置为一个脚本,该脚本将使用该密钥加载 putty,并且可以在 gitBASH 中正常工作,但在 Hudson 中仍然失败。

以下是使用 PUTTY 失败的输出:

    Started by user anonymous
Checkout:workspace / <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/> - hudson.remoting.LocalChannel@1c57a92
Using strategy: Default
Last Built Revision: Revision 2a56d9738e7c0af810e70e2e2051c41bd44f4252 (origin/master) Checkout:workspace / <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/> - hudson.remoting.LocalChannel@1c57a92
GitAPI created
Cloning the remote Git repository
Cloning repository origin
$ C:\bin\Git\bin\git clone -o origin git@GITSERVER:project.git <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/>
ERROR: Error cloning remote repo 'origin' : Could not clone git@GITSERVER:project.git
ERROR: Cause: Error performing C:\bin\Git\bin\git clone -o origin git@GITSERVER:project.git <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/>
Command returned status code 128: Cloning into <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/...>
fatal: The remote end hung up unexpectedly

    Trying next repository
    ERROR: Could not clone repository
    FATAL: Could not clone
    hudson.plugins.git.GitException: Could not clone
     at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:809)
     at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:740)
     at hudson.FilePath.act(FilePath.java:756)
     at hudson.FilePath.act(FilePath.java:738)
     at hudson.plugins.git.GitSCM.checkout(GitSCM.java:740)
     at hudson.model.AbstractProject.checkout(AbstractProject.java:1171)
     at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:480)
     at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:412)
     at hudson.model.Run.run(Run.java:1362)
     at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
     at hudson.model.ResourceController.execute(ResourceController.java:88)
     at hudson.model.Executor.run(Executor.java:145)

只要 SSH 协议有效,我们对 SSH 协议并不严格,如果有人可以告诉我为什么 openSSH 会失败,或者为什么 Hudson 使用 putty 失败以及任何解决方案,我会非常高兴感激的!!

We had Hudson set up with Git + OpenSSH on Windows Server 2003 Enterprise and it was working fine for a while.
Then suddenly, it started to hang during a clone at 12% always, we suspected maybe the files had gotten too big. (It is still working fine on all other machines, Windows Server 2003 standard, Windows 7 Enterprise), just this one server.

So we switched to Putty instead of OpenSSH, and it worked from gitBash and gitExtensions, but fails still from Hudson.
Since I've read that there are some concerns regarding the ssh key loading properly for plink, I have set GIT_SSH to a script that will load putty with the key and that works fine from gitBASH, but it still fails with Hudson.

Here is the output of the failure using PUTTY:

    Started by user anonymous
Checkout:workspace / <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/> - hudson.remoting.LocalChannel@1c57a92
Using strategy: Default
Last Built Revision: Revision 2a56d9738e7c0af810e70e2e2051c41bd44f4252 (origin/master) Checkout:workspace / <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/> - hudson.remoting.LocalChannel@1c57a92
GitAPI created
Cloning the remote Git repository
Cloning repository origin
$ C:\bin\Git\bin\git clone -o origin git@GITSERVER:project.git <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/>
ERROR: Error cloning remote repo 'origin' : Could not clone git@GITSERVER:project.git
ERROR: Cause: Error performing C:\bin\Git\bin\git clone -o origin git@GITSERVER:project.git <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/>
Command returned status code 128: Cloning into <http://WINDOWS2003SERVER:8080/job/PROJECT/ws/...>
fatal: The remote end hung up unexpectedly

    Trying next repository
    ERROR: Could not clone repository
    FATAL: Could not clone
    hudson.plugins.git.GitException: Could not clone
     at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:809)
     at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:740)
     at hudson.FilePath.act(FilePath.java:756)
     at hudson.FilePath.act(FilePath.java:738)
     at hudson.plugins.git.GitSCM.checkout(GitSCM.java:740)
     at hudson.model.AbstractProject.checkout(AbstractProject.java:1171)
     at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:480)
     at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:412)
     at hudson.model.Run.run(Run.java:1362)
     at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
     at hudson.model.ResourceController.execute(ResourceController.java:88)
     at hudson.model.Executor.run(Executor.java:145)

We are not strict with our SSH protocol so long as it works, If someone can possibly tell me why with openSSH it fails, or why Hudson fails with putty and any solutions, I would be very grateful!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

美人迟暮 2024-10-19 14:44:28

我一直不明白为什么 openSSH 不能工作,但我终于让 PuTTY 一​​切正常了。

我的解决方案如下:
我创建了一个名为 myplink.bat 的批处理文件,它将使用私钥执行 putty 并且不需要运行 pageant。
该文件内部内容如下:

@echo off
c:\pathto\plink.exe -i c:\pathto\id_rsa.pub

打开 gitbash 提示符并将 GIT_SSH 更改为该路径仅适用于该实例,为了使其永久设置为我修改的 gitbash
c:\pathto\git\etc\profile 并在最后添加:

export GIT_SSH=c:\pathto\myplink.bat

我也修改了
c:\pathto\git\cmd\git.cmd 并补充说:

@set GIT_SSH=c:\pathto\myplink.bat

这修复了 git bash,但 hudson 仍然会失败,让我相信 hudson 的环境会以某种方式为 git 改变。
然后在哈德逊,我去管理哈德逊->配置设置->环境变量
我确保它已被检查,并添加:
名称:GIT_SSH
value: c:\pathto\myplink.bat

我重新启动了hudson服务,终于成功了。

请注意,如果您的任何路径中有空格,也可能会搞砸,因此请尽量保持路径空闲。

希望这可以帮助其他遇到 hudson+git+putty 问题的人。

I couldn't ever figure out why openSSH wasn't working, but I did finally get everything working with PuTTY.

My solution was as follows:
I created a batch file called: myplink.bat, that would execute putty with the private key and not require pageant to be running.
Inside that file was the following:

@echo off
c:\pathto\plink.exe -i c:\pathto\id_rsa.pub

Opening up a gitbash prompt and changing GIT_SSH to this path would only work for that instance, in order to get it to be permanently set for gitbash I modified
c:\pathto\git\etc\profile and added at the end:

export GIT_SSH=c:\pathto\myplink.bat

I also modified
c:\pathto\git\cmd\git.cmd And added:

@set GIT_SSH=c:\pathto\myplink.bat

This fixed git bash, but hudson would still fail, leaving me to believe hudson's environment gets changed for git somehow.
Then in hudson, i went to manage hudson -> configure settings -> environment variables
I made sure it was checked, and added:
name: GIT_SSH
value: c:\pathto\myplink.bat

I restarted the hudson service, and it finally worked.

Please note if you have spaces in any of your paths, that might screw up stuff too, so try to keep your paths space free.

Hope this helps others who have issues with hudson+git+putty.

殤城〤 2024-10-19 14:44:28

您的 git 服务器上没有公钥。以“git”身份登录时,从 Hudson 服务器执行此操作。

ssh -v gitserver

研究输出。不应提示您输入密码。

如果您这样做或遇到其他问题,则说明您没有设置 ssh 密钥。

希望这有帮助

You don't have the public key on your git server. Do this from the hudson server when logged in as 'git'.

ssh -v gitserver

Study the output. You should NOT get prompted for a password.

If you do, or have other problems, you don't have your ssh keys set up.

hope this helps

泅渡 2024-10-19 14:44:28

您必须检查以下内容:

  1. 您正在使用运行 hudson 守护程序的用户的 ssh 密钥。例如,如果 user=hudson,那么您应该以 hudson 身份登录并生成 ssh 密钥
  2. 您已从正确的 .ssh/id_rsa.pub 文件(即运行 hudson 的同一用户)将公钥加载到您的服务器(github、assembla)守护进程
  3. 您已将服务器的 RSA 指纹添加到 .ssh/known_hosts 文件中

You have to check the following:

  1. You are using ssh keys of the user who ran hudson daemon. For example, if user=hudson, then you should log on as hudson and generate ssh keys
  2. You have loaded your public key to your server (github, assembla) from correct .ssh/id_rsa.pub file i.e. for the same user who ran hudson daemon
  3. You have added RSA fingerprint of your server to your .ssh/known_hosts file
你是我的挚爱i 2024-10-19 14:44:28

我在 linux(Ubuntu) 服务器上运行时遇到同样的问题。此链接(http://adhocery.blogspot.com/2009/11/git-and-hudson.html)解决了我的问题。

下面的文字是从链接复制的。

事实证明,Git 需要设置一个用户名,而安装 Hudson 时 Debian 软件包创建的 hudson 用户没有用户名。通过使用 sudo nano /etc/passwd 将 Hudson,,, 添加到 hudson 用户的条目中(如果您查看自己的条目,您应该会看到它需要去哪里),可以轻松修复。

I have the same problem running on linux(Ubuntu) Server. This link(http://adhockery.blogspot.com/2009/11/git-and-hudson.html) fixed my problem.

Below text is copied from the link.

It turns out Git needs a username to be set and the hudson user that the Debian package creates when Hudson is installed doesn't have one. Easily fixed by using sudo nano /etc/passwd to add Hudson,,, into the hudson user's entry (if you look at your own entry you should see where it needs to go).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文