I'm trying to fetch a read-only git repository from github and have it be built via hudson. This process is failing.
This is the hudson output:
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)
When I run that fetch command directly via the git bash command line, I get no response (which I assume means it's worked).
I looked at this possible solution: http://issues.hudson-ci.org/browse/HUDSON-7141?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
But using that version of the plugin did not change this behavior.
I haven't even gotten to having it work with cmake yet, just downloaded consistently. How can I get this to work?
edit: This problem is not a repro of Problem cloning / fetching repository using Git plugin for Hudson on Windows, because I'm not running as a service on a server.
Yes, I just fixed this exact problem. If you open a windows explorer to d:\hudson\home\jobs\gdcm-hudson\workspace
you should be able to see a .git
directory and nothing else. There should be a working copy but there isn't. To fix this you have to "prime" the repository by running
git pull git://github.com/malaterre/gdcm.git
This should create a bunch of other files in d:\hudson\home\jobs\gdcm-hudson\workspace
along side the .git directory and you should be able to perform a build in hudson.
This occurred to me on a build that was previously working fine. The solution was just to delete the workspace directory and restart the build.
The Git plugin for Hudson fails only recently on this kind of error message (issue 6902, July 2010). Before it used to go on silently (which was misleading).
Do you have any submodules defined?
Because it looks like Git Plugin Bug 4
I have the following setup:
- a branch called "master", that contains a submodule to another project
- a branch called "develop", that does not contain a submodule reference
If I configure a Hudson job to build/test the "develop" branch, the build breaks, because it cannot do the submodule checkout. Because this happens before switching to the "develop" branch, the build is broken before anything started.
Solution
I assume the output of
git ls-tree HEAD
is scanned for 160000 references to determine which entries are submodules.
The refHEAD
at that point still points tomaster
, I suppose in most cases.
Instead ofls-tree
'ingHEAD
, maybe do it on the specified branch?
After deleting the Hudson workspace directory .hudson
, it works for me. I'm using Hudson 2.2.1
and the git plugin 2.2.1
.
For the record, in my case the problem was that there was a special Git executable configured (in global Hudson settings). This executable failed to run on some of my build hosts due to missing libraries. When using /usr/bin/git instead it worked.
So it looks like the described error message really can indicate any Git error at all.
来源:https://stackoverflow.com/questions/3705078/why-does-git-fetch-via-hudson-fail-while-git-fetch-via-the-command-line-works