Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64314

FATAL: Invalid id: fatal: ambiguous argument 'refs/remotes/origin/master^{commit}

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Jenkins Job Error Log:

      Started by user abc

      Running as SYSTEM

      Building remotely on ZOS-Agent (ABC1234) in workspace /u/rabc/Jenkins-PC/workspace/pocPipeline

      The recommended git tool is: NONE

      using credential rabcprivatekey

       > /var/dbb/bin/git-jenkins.sh rev-parse --is-inside-work-tree # timeout=10

      Fetching changes from the remote Git repository

       > /var/dbb/bin/git-jenkins.sh config remote.origin.url git@github.com:rayabcgit/poc-workspace.git # timeout=10

      Fetching upstream changes from git@github.com:rayabcgit/poc-workspace.git

       > /var/dbb/bin/git-jenkins.sh --version # timeout=10

       > git --version # 'git version 2.14.4_zos_b09'

      using GIT_SSH to set credentials Private Key from USS  for github

       > /var/dbb/bin/git-jenkins.sh fetch --tags --progress – git@github.com:rayabcgit/poc-workspace.git +refs/heads/:refs/remotes/origin/ # timeout=10

       > /var/dbb/bin/git-jenkins.sh rev-parse refs/remotes/origin/master^{commit} # timeout=10

      FATAL: Invalid id: fatal: ambiguous argument 'refs/remotes/origin/master^{commit}': unknown revision or path not in the working tree.

      Use '--' to separate paths from revisions, like this:

      'git <command> [<revision>...][<file>...]'

      refs/remotes/origin/master^{commit}

      Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to ZOS-Agent

                                    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)

                                    at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)

                                    at hudson.remoting.Channel.call(Channel.java:1001)

                                    at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:286)

                                    at com.sun.proxy.$Proxy66.revParse(Unknown Source)

                                    at org.jenkinsci.plugins.gitclient.RemoteGitImpl.revParse(RemoteGitImpl.java:577)

                                    at hudson.plugins.git.util.DefaultBuildChooser.getHeadRevision(DefaultBuildChooser.java:129)

                                    at hudson.plugins.git.util.DefaultBuildChooser.getCandidateRevisions(DefaultBuildChooser.java:111)

                                    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1145)

                                    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1298)

                                    at hudson.scm.SCM.checkout(SCM.java:505)

                                    at hudson.model.AbstractProject.checkout(AbstractProject.java:1206)

                                    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)

                                    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)

                                    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)

                                    at hudson.model.Run.execute(Run.java:1894)

                                    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)

                                    at hudson.model.ResourceController.execute(ResourceController.java:97)

                                    at hudson.model.Executor.run(Executor.java:428)

      org.eclipse.jgit.errors.InvalidObjectIdException: Invalid id: fatal: ambiguous argument 'refs/remotes/origin/master^{commit}': unknown revision or path not in the working tree.

      Use '--' to separate paths from revisions, like this:

      'git <command> [<revision>...][<file>...]'

      refs/remotes/origin/master^{commit}

                     at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:203)

                     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:1041)

                     at hudson.plugins.git.GitAPI.revParse(GitAPI.java:331)

                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)

                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)

                     at java.lang.reflect.Method.invoke(Method.java:508)

                     at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:936)

                     at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:909)

                     at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:860)

                     at hudson.remoting.UserRequest.perform(UserRequest.java:211)

                     at hudson.remoting.UserRequest.perform(UserRequest.java:54)

                     at hudson.remoting.Request$2.run(Request.java:375)

                     at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:73)

                     at java.util.concurrent.FutureTask.run(FutureTask.java:277)

                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)

                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

                     at java.lang.Thread.run(Thread.java:820)

      Finished: FAILURE

       

        Attachments

          Activity

          Hide
          raylamjenkins Ray Lam added a comment -

          Jenkins is still using origin/master instead of origin/main

          Rabc:/u/rabc/poc-workspace>git rev-parse refs/remotes/origin/master
          refs/remotes/origin/master
          fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
          Use '--' to separate paths from revisions, like this:
          'git <command> [<revision>...][<file>...]'
          Rabc:/u/rabc/poc-workspace>git rev-parse refs/remotes/origin/main
          f4faabb108db25e0d8a9a470643b11a99de6f750
          Rabc:/u/rabc/poc-workspace>

          Show
          raylamjenkins Ray Lam added a comment - Jenkins is still using origin/master instead of origin/main Rabc:/u/rabc/poc-workspace>git rev-parse refs/remotes/origin/ master refs/remotes/origin/master fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] – [<file>...] ' Rabc:/u/rabc/poc-workspace>git rev-parse refs/remotes/origin/ main f4faabb108db25e0d8a9a470643b11a99de6f750 Rabc:/u/rabc/poc-workspace>
          Hide
          markewaite Mark Waite added a comment -

          I believe this is a configuration error in your job definition, not an error in Jenkins.

          You control the name of the branch which is to be used for a job. Jenkins offers a default (master) that you are welcome to change to whatever value you would like. In this case, it needs to be changed to 'main' since that is the new default branch name for GitHub repositories. I confirmed that a newly created GitHub repository uses 'main' as the default branch and that a Jenkins job configured to use that repository works as expected.

          Show
          markewaite Mark Waite added a comment - I believe this is a configuration error in your job definition, not an error in Jenkins. You control the name of the branch which is to be used for a job. Jenkins offers a default (master) that you are welcome to change to whatever value you would like. In this case, it needs to be changed to 'main' since that is the new default branch name for GitHub repositories. I confirmed that a newly created GitHub repository uses 'main' as the default branch and that a Jenkins job configured to use that repository works as expected.
          Hide
          raylamjenkins Ray Lam added a comment -

          Hi Mark,

          I was wondering who generates the following command  (/var/dbb/bin/git-jenkins.sh rev-parse refs/remotes/origin/master) that caused the error, and where can I ichange it from master to main.

          > /var/dbb/bin/git-jenkins.sh rev-parse refs/remotes/origin/master^{commit} # timeout=10

          FATAL: Invalid id: fatal: ambiguous argument 'refs/remotes/origin/master^{commit}': unknown revision or path not in the working tree.

          Use '--' to separate paths from revisions, like this:

          'git <command> [<revision>...] – [<file>...]'

          refs/remotes/origin/master^{commit}

          Show
          raylamjenkins Ray Lam added a comment - Hi Mark, I was wondering who generates the following command  ( /var/dbb/bin/git-jenkins.sh rev-parse refs/remotes/origin/master ) that caused the error, and where can I ichange it from master to main. > /var/dbb/bin/git-jenkins.sh rev-parse refs/remotes/origin/ master ^{commit} # timeout=10 FATAL: Invalid id: fatal: ambiguous argument 'refs/remotes/origin/master^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command>  [<revision>...]  –  [<file>...] ' refs/remotes/origin/master^{commit}

            People

            Assignee:
            markewaite Mark Waite
            Reporter:
            raylamjenkins Ray Lam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: