问题
When using the Git plugin for Hudson my job always fails when fetching the latest sources from my online git repository ( git://github.com/ithena/orm2dsl.git ) .
The git plugin first executes git fetch
succesfully. Then it tries to execute git checkout -f origin/
, which fails as shown below. Is this a problem with my git repository or is it the checkout command that makes no sense?
Git command whithout a branch set in the job configuration:
git checkout -f origin/
git checkout: updating paths is incompatible with switching branches/forcing
Did you intend to checkout 'origin/' which can not be resolved as commit?
Git command with branch set to master in the job configuration:
git checkout -f origin/master
git checkout: updating paths is incompatible with switching branches/forcing
Did you intend to checkout 'origin/master' which can not be resolved as commit?
Hudson console output:
started
Checkout
[workspace] $ git fetch
Checking out origin/
[workspace] $ git checkout -f origin/
git checkout: updating paths is incompatible with switching branches/forcing
Did you intend to checkout 'origin/' which can not be resolved as commit?
FATAL: Error checking out origin/
java.lang.RuntimeException: Error checking out origin/
at hudson.plugins.git.GitAPI.launch(GitAPI.java:101)
at hudson.plugins.git.GitAPI.checkout(GitAPI.java:94)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:90)
at hudson.model.AbstractProject.checkout(AbstractProject.java:693)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:266)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:239)
at hudson.model.Run.run(Run.java:842)
at hudson.model.Build.run(Build.java:88)
at hudson.model.ResourceController.execute(ResourceController.java:70)
at hudson.model.Executor.run(Executor.java:90)
Hudson Environment: Debian Etch, Sun JSDK 6, git 1.4.4.4, hudson latest stable download
回答1:
First, your version of Git is pretty old. I suggest you update it before you do anything else.
Second, git checkout -f origin/
is not a valid command. You either need to checkout a branch, or you can checkout a commit (by specifying the commit hash or a tag) and create a new branch of it at the same (using git checkout -b new-branch commit-hash
). See the git-checkout man page for further details.
来源:https://stackoverflow.com/questions/499316/git-plugin-for-hudson-checkout-problem