Maven Error: “Bare Repository has neither a working tree, nor an index”

I suddenly couldn’t build a Maven project at work because of the error below…. Did some googling but didn’t really find helpful info, other than that I was touching a “bare” repository. I thought about it for a second and realized that maybe my changing the artifact version in the pom had something to do with it (I did this as another branch had increased the version).

I quickly rolled it back to the previous version, committed and pushed, and, voila, Jenkins started building my project successfully again.

Adding it here in case someone gets bit with this [annoying] error.


18:17:46 [info] HEAD is [ de8cb9011de6b1fc101ac8133875aaf076b9bbe3 ]
18:17:46 org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
18:17:46 at org.eclipse.jgit.lib.Repository.getWorkTree(Repository.java:1246)
18:17:46 at org.eclipse.jgit.treewalk.FileTreeIterator.(FileTreeIterator.java:88)
18:17:46 at org.eclipse.jgit.api.StatusCommand.call(StatusCommand.java:126)
18:17:46 at pl.project13.jgit.DescribeCommand.findDirtyState(DescribeCommand.java:360)
18:17:46 at pl.project13.jgit.DescribeCommand.call(DescribeCommand.java:296)
18:17:46 at pl.project13.maven.git.JGitProvider.getGitDescribe(JGitProvider.java:225)
18:17:46 at pl.project13.maven.git.JGitProvider.getGitDescribe(JGitProvider.java:122)
18:17:46 at pl.project13.maven.git.GitDataProvider.maybePutGitDescribe(GitDataProvider.java:93)
18:17:46 at pl.project13.maven.git.GitDataProvider.loadGitData(GitDataProvider.java:63)
18:17:46 at pl.project13.maven.git.GitCommitIdMojo.loadGitDataWithJGit(GitCommitIdMojo.java:485)
18:17:46 at pl.project13.maven.git.GitCommitIdMojo.loadGitData(GitCommitIdMojo.java:457)
18:17:46 at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:315)
18:17:46 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
18:17:46 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
18:17:46 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
18:17:46 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
18:17:46 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
18:17:46 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
18:17:46 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
18:17:46 at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
18:17:46 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
18:17:46 at java.lang.reflect.Method.invoke(Method.java:483)
18:17:46 at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
18:17:46 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
18:17:46 at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:17:46 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
18:17:46 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
18:17:46 at java.lang.reflect.Method.invoke(Method.java:483)
18:17:46 at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
18:17:46 at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
18:17:46 at hudson.remoting.UserRequest.perform(UserRequest.java:121)
18:17:46 at hudson.remoting.UserRequest.perform(UserRequest.java:49)
18:17:46 at hudson.remoting.Request$2.run(Request.java:324)
18:17:46 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
18:17:46 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
18:17:46 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
18:17:46 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
18:17:46 at java.lang.Thread.run(Thread.java:744)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.