TJamesBoone TJamesBoone -4 years ago 268
Git Question

Hudson error when checking out from Git: "One of setGitDir or setWorkTree must be called"

I'm getting an error when I attempt to build a project from GIT on Hudson. The project is in GitHub, if that might make a difference.

The error is:

FATAL: One of setGitDir or setWorkTree must be called.


I haven't been able to find any useful information online or on StackOverflow for how to deal with this. I don't even know where to begin to figure this out.

This is the full console output:

Started by user anonymous
Checkout:workspace / D:\Hudson\jobs\{Name of App}\workspace - hudson.remoting.LocalChannel@1c2a5b50
Using strategy: Default
Checkout:workspace / D:\Hudson\jobs\{Name of App}\workspace - hudson.remoting.LocalChannel@1c2a5b50
FATAL: One of setGitDir or setWorkTree must be called.
java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called.
at org.eclipse.jgit.lib.BaseRepositoryBuilder.requireGitDirOrWorkTree(BaseRepositoryBuilder.java:538)
at org.eclipse.jgit.lib.BaseRepositoryBuilder.setup(BaseRepositoryBuilder.java:506)
at org.eclipse.jgit.storage.file.FileRepositoryBuilder.build(FileRepositoryBuilder.java:89)
at hudson.plugins.git.GitAPI.<init>(GitAPI.java:92)
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:897)
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:889)
at hudson.FilePath.act(FilePath.java:791)
at hudson.FilePath.act(FilePath.java:773)
at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:889)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:668)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1515)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:521)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:428)
at hudson.model.Run.run(Run.java:1390)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:40)
at hudson.model.ResourceController.execute(ResourceController.java:82)
at hudson.model.Executor.run(Executor.java:137)


Here are screen shots showing how I have the project configured with GIT:

enter image description here
enter image description here

Answer Source

Huh. Not sure why this solved it, but I was able to make the error go away by Wiping Out the Workspace.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download