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

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-plugin, pipeline
    • None
    • git plugin 4.5.0

      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' 

          [JENKINS-64320] git pipeline step fails to check out default branch in a repo without master branch

          Daniel Beck created issue -
          Mark Waite made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Mark Waite made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Mark Waite made changes -
          Remote Link New: This issue links to "PR 1006 - correct the help text (Web Link)" [ 26336 ]
          Mark Waite made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Fixed but Unreleased [ 10203 ]
          Mark Waite made changes -
          Released As New: git plugin 4.5.0
          Status Original: Fixed but Unreleased [ 10203 ] New: Closed [ 6 ]

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

              Created:
              Updated:
              Resolved: