【问题标题】:Why does git fetch via hudson fail, while git fetch via the command line works?为什么 git fetch via hudson 失败,而 git fetch via command line 有效?
【发布时间】:2011-04-11 22:18:26
【问题描述】:

我正在尝试从 github 获取一个只读的 git 存储库,并通过 hudson 构建它。此过程失败。

这是哈德逊输出:

Started by an SCM change
Checkout:workspace / d:\hudson\home\jobs\gdcm-hudson\workspace - hudson.remoting.LocalChannel@19ba1d8
Using strategy: Default
Checkout:workspace / d:\hudson\home\jobs\gdcm-hudson\workspace - hudson.remoting.LocalChannel@19ba1d8
GitAPI created
Fetching changes from the remote Git repository
Fetching upstream changes from git://github.com/malaterre/gdcm.git
[workspace] $ "C:\Program Files (x86)\Git\bin\git.exe" fetch -t git://github.com/malaterre/gdcm.git +refs/heads/*:refs/remotes/origin/*
[workspace] $ "C:\Program Files (x86)\Git\bin\git.exe" ls-tree HEAD
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository
hudson.plugins.git.GitException: Could not fetch from any repository
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:674)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:641)
    at hudson.FilePath.act(FilePath.java:753)
    at hudson.FilePath.act(FilePath.java:735)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:641)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1061)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
    at hudson.model.Run.run(Run.java:1273)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:129)

当我直接通过 git bash 命令行运行该 fetch 命令时,我没有得到任何响应(我认为这意味着它有效)。

我查看了这个可能的解决方案: http://issues.hudson-ci.org/browse/HUDSON-7141?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

但使用该版本的插件并没有改变这种行为。

我什至还没有让它与 cmake 一起工作,只是不断地下载。我怎样才能让它工作?

编辑:这个问题不是Problem cloning / fetching repository using Git plugin for Hudson on Windows 的重现,因为我没有在服务器上作为服务运行。

【问题讨论】:

    标签: git hudson git-fetch


    【解决方案1】:

    是的,我刚刚解决了这个确切的问题。如果您打开 Windows 资源管理器到 d:\hudson\home\jobs\gdcm-hudson\workspace,您应该能够看到 .git 目录,而没有其他任何东西。应该有一个工作副本,但没有。要解决此问题,您必须通过运行“启动”存储库

    git pull git://github.com/malaterre/gdcm.git
    

    这应该会在 .git 目录旁边的 d:\hudson\home\jobs\gdcm-hudson\workspace 中创建一堆其他文件,并且您应该能够在 hudson 中执行构建。

    【讨论】:

    • kelloti 你的意思是我必须将我的存储库克隆到工作区吗?
    • 我已经有一段时间没有这样做了,但如果它没有被克隆,你可能需要克隆它,所以是的。在我给出的答案中,我只需要拉一次就可以开始了。您可能遇到了完全不同的问题。
    【解决方案2】:

    这发生在我之前运行良好的构建中。解决方案就是删除工作区目录并重新构建。

    【讨论】:

      【解决方案3】:

      Hudson 的 Git 插件最近才因此类错误消息 (issue 6902, July 2010) 而失败。在它过去常常默默地进行之前(这是误导性的)。

      您是否定义了任何子模块?
      因为它看起来像Git Plugin Bug 4

      我有以下设置:

      • 一个名为“master”的分支,其中包含另一个项目的子模块
      • 名为“develop”的分支,不包含子模块引用

      如果我配置一个 Hudson 作业来构建/测试“开发”分支,构建会中断,因为它无法执行子模块检出。因为这发生在切换到“开发”分支之前,所以构建在任何开始之前就被破坏了。

      解决方案

      我假设 git ls-tree HEAD 的输出被扫描了 160000 个引用以确定哪些条目是子模块。
      我想在大多数情况下,当时的 ref HEAD 仍然指向 master
      而不是ls-tree'ing HEAD,也许在指定的分支上做?

      【讨论】:

        【解决方案4】:

        作为记录,在我的情况下,问题是配置了一个特殊的 Git 可执行文件(在全局 Hudson 设置中)。由于缺少库,此可执行文件无法在我的某些构建主机上运行。当使用 /usr/bin/git 时,它起作用了。

        所以看起来描述的错误消息确实可以指示 任何 Git 错误。

        【讨论】:

          猜你喜欢
          • 2014-01-18
          • 2014-03-31
          • 2017-12-02
          • 2018-04-11
          • 2022-06-14
          • 2010-11-08
          • 2022-12-01
          • 2018-11-23
          • 2011-03-22
          相关资源
          最近更新 更多