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

git pipeline step fails to check out default branch in a repo without master branch

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      git plugin 4.5.0

      Description

      The git pipeline steps documentation states that it checks out the default branch if none is specified:

      https://github.com/jenkinsci/git-plugin/blob/3475e01fa478174b860a384b9b785b00a7051703/src/main/resources/jenkins/plugins/git/GitStep/help-branch.html#L3

      This doesn't seem to be true, as a repo without master branch will cause the error:

      ...
      [Pipeline] {
      [Pipeline] git
      using credential credentialId
      Cloning the remote Git repository
      remote: Enumerating objects
      remote: Counting objects
      remote: Compressing objects
      Receiving objects
      Resolving deltas
      [Pipeline] }
      [Pipeline] // dir
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. 

      Affected pipeline snippet:

      git credentialsId: 'credentialId', url: 'https://github.com/orgname/reponame' 

      This worked:

      git credentialsId: 'credentialId', url: 'https://github.com/orgname/reponame', branch: 'default-branchname-specified-explicitly' 

        Attachments

          Issue Links

            Activity

            There are no comments yet on this issue.

              People

              Assignee:
              markewaite Mark Waite
              Reporter:
              danielbeck Daniel Beck
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: