hudson.plugins.git.GitException: Unknown git object /master

Jenkins JIRA | Dominik Bartholdi | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    To be able to do a proper release with the maven-release plugin, we need to be running the build on a clean checkout of a branch (not a detached HEAD). I'm trying to do this with the "Additional Behavior" "Check out to specifig local branch" (see screenshot). But when using jgit, I get this exception: {code} Started by user admin [EnvInject] - Loading node environment variables. Building on master in workspace /Users/Shared/Jenkins/Home/jobs/dummy-tester/workspace Fetching changes from the remote Git repository Merging Revision 71099115b31453ae1d17e1808d46a7b6f8782fb4 (origin/master) onto /master FATAL: Unknown git object /master hudson.plugins.git.GitException: Unknown git object /master at org.jenkinsci.plugins.gitclient.JGitAPIImpl.revParse(JGitAPIImpl.java:829) at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:60) at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:765) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:832) at hudson.model.AbstractProject.checkout(AbstractProject.java:1387) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581) at hudson.model.Run.execute(Run.java:1593) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:491) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:247) {code} When I change the "Branch name" from "master" to "origin/master", it does not fail, but it also does not checkout a branch (I used a shell step with "git branch" to check the branch I'm staying on): {code} Building on master in workspace /Users/Shared/Jenkins/Home/jobs/dummy-tester-jgit/workspace Fetching changes from the remote Git repository Checking out Revision 71099115b31453ae1d17e1808d46a7b6f8782fb4 (origin/master) [workspace] $ /bin/sh -xe /var/folders/c1/m1rcv3kj7g5250lfh3frv_s800009c/T/hudson2838431825011865626.sh + git branch * (no branch) master null origin/master Parsing POMs [workspace] $ java -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/Users/Shared/Jenkins/Home/tools/hudson.tasks.Maven_MavenInstallation/MVN_303/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /Users/Shared/Jenkins/Home/tools/hudson.tasks.Maven_MavenInstallation/MVN_303 /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.28.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar 49195 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 <===[JENKINS REMOTING CAPACITY]===>channel started {code} Doing the same (Branch name: "master) with cgit, I get this output, also telling that we really stay on a branch: {code} Building on master in workspace /Users/Shared/Jenkins/Home/jobs/dummy-tester-cgit/workspace Fetching changes from the remote Git repository Fetching upstream changes from origin Checking out Revision 71099115b31453ae1d17e1808d46a7b6f8782fb4 (origin/master) First time build. Skipping changelog. [workspace] $ /bin/sh -xe /var/folders/c1/m1rcv3kj7g5250lfh3frv_s800009c/T/hudson1975846668439542655.sh + git branch * master Parsing POMs {code} I also tried the same with the additional behavior "Merge before build", but the result is about the same.

    Jenkins JIRA | 4 years ago | Dominik Bartholdi
    hudson.plugins.git.GitException: Unknown git object /master
  2. 0

    To be able to do a proper release with the maven-release plugin, we need to be running the build on a clean checkout of a branch (not a detached HEAD). I'm trying to do this with the "Additional Behavior" "Check out to specifig local branch" (see screenshot). But when using jgit, I get this exception: {code} Started by user admin [EnvInject] - Loading node environment variables. Building on master in workspace /Users/Shared/Jenkins/Home/jobs/dummy-tester/workspace Fetching changes from the remote Git repository Merging Revision 71099115b31453ae1d17e1808d46a7b6f8782fb4 (origin/master) onto /master FATAL: Unknown git object /master hudson.plugins.git.GitException: Unknown git object /master at org.jenkinsci.plugins.gitclient.JGitAPIImpl.revParse(JGitAPIImpl.java:829) at hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:60) at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:765) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:832) at hudson.model.AbstractProject.checkout(AbstractProject.java:1387) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581) at hudson.model.Run.execute(Run.java:1593) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:491) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:247) {code} When I change the "Branch name" from "master" to "origin/master", it does not fail, but it also does not checkout a branch (I used a shell step with "git branch" to check the branch I'm staying on): {code} Building on master in workspace /Users/Shared/Jenkins/Home/jobs/dummy-tester-jgit/workspace Fetching changes from the remote Git repository Checking out Revision 71099115b31453ae1d17e1808d46a7b6f8782fb4 (origin/master) [workspace] $ /bin/sh -xe /var/folders/c1/m1rcv3kj7g5250lfh3frv_s800009c/T/hudson2838431825011865626.sh + git branch * (no branch) master null origin/master Parsing POMs [workspace] $ java -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/Users/Shared/Jenkins/Home/tools/hudson.tasks.Maven_MavenInstallation/MVN_303/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /Users/Shared/Jenkins/Home/tools/hudson.tasks.Maven_MavenInstallation/MVN_303 /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.28.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar 49195 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 <===[JENKINS REMOTING CAPACITY]===>channel started {code} Doing the same (Branch name: "master) with cgit, I get this output, also telling that we really stay on a branch: {code} Building on master in workspace /Users/Shared/Jenkins/Home/jobs/dummy-tester-cgit/workspace Fetching changes from the remote Git repository Fetching upstream changes from origin Checking out Revision 71099115b31453ae1d17e1808d46a7b6f8782fb4 (origin/master) First time build. Skipping changelog. [workspace] $ /bin/sh -xe /var/folders/c1/m1rcv3kj7g5250lfh3frv_s800009c/T/hudson1975846668439542655.sh + git branch * master Parsing POMs {code} I also tried the same with the additional behavior "Merge before build", but the result is about the same.

    Jenkins JIRA | 4 years ago | Dominik Bartholdi
    hudson.plugins.git.GitException: Unknown git object /master

    Root Cause Analysis

    1. hudson.plugins.git.GitException

      Unknown git object /master

      at org.jenkinsci.plugins.gitclient.JGitAPIImpl.revParse()
    2. org.jenkinsci.plugins
      JGitAPIImpl.revParse
      1. org.jenkinsci.plugins.gitclient.JGitAPIImpl.revParse(JGitAPIImpl.java:829)
      1 frame
    3. hudson.plugins.git
      PreBuildMerge.decorateRevisionToBuild
      1. hudson.plugins.git.extensions.impl.PreBuildMerge.decorateRevisionToBuild(PreBuildMerge.java:60)
      1 frame
    4. Hudson GIT plugin
      GitSCM.checkout
      1. hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:765)
      2. hudson.plugins.git.GitSCM.checkout(GitSCM.java:832)
      2 frames
    5. Hudson
      AbstractBuild$AbstractBuildExecution.defaultCheckout
      1. hudson.model.AbstractProject.checkout(AbstractProject.java:1387)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
      2 frames
    6. jenkins.scm
      SCMCheckoutStrategy.checkout
      1. jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      1 frame
    7. Hudson
      Run.execute
      1. hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
      2. hudson.model.Run.execute(Run.java:1593)
      2 frames
    8. Hudson Maven Embedder
      MavenModuleSetBuild.run
      1. hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:491)
      1 frame
    9. Hudson
      Executor.run
      1. hudson.model.ResourceController.execute(ResourceController.java:88)
      2. hudson.model.Executor.run(Executor.java:247)
      2 frames