Why does git fetch via hudson fail, while git fetch via the command line works?

风流意气都作罢 提交于 2019-12-03 11:38:57

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 ref HEAD at that point still points to master, I suppose in most cases.
Instead of ls-tree'ing HEAD, maybe do it on the specified branch?

acneto

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!