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

Git fails to fetch from private repo when credentials manager enabled

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Component/s: git-client-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.121.1 (as a windows service)
      git plugin 3.9.1
    • Similar Issues:

      Description

      I have a jenkins job setup to run from our internal github enterprise which works fine when the repo is set to public. However I have been asked to make this private and now jenkins fails to scm checkout. 

      Started by user Scott Matthews
      ERROR: Could not determine exact tip revision of PR-56; falling back to nondeterministic checkout
      Checking out git https://<GithubEnterpriseUrl>/<OrgName>/Packer.git into C:\Program Files (x86)\Jenkins\workspace\Packer_Server_1607_PR-56-P5STWH6IZAJIWUQA43GHWPPPURV3J7TCIKPUIVQ6RFD5AL3GYG5Q@script to read jenkins/server1607.groovy
       > git.exe rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git.exe config remote.origin.url https://<GithubEnterpriseUrl>/<OrgName>/Packer.git # timeout=10
      Fetching without tags
      Fetching upstream changes from https://<GithubEnterpriseUrl>/<OrgName>/Packer.git
       > git.exe --version # timeout=10
      using GIT_ASKPASS to set credentials OAuth Token for wba-jenkins-scm
       > git.exe fetch --no-tags --progress https://<GithubEnterpriseUrl>/<OrgName>/Packer.git +refs/pull/56/head:refs/remotes/origin/PR-56 +refs/heads/master:refs/remotes/origin/master
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from https://<GithubEnterpriseUrl>/<OrgName>/Packer.git
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
      	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:144)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:298)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Caused by: hudson.plugins.git.GitException: Command "git.exe fetch --no-tags --progress https://<GithubEnterpriseUrl>/<OrgName>/Packer.git +refs/pull/56/head:refs/remotes/origin/PR-56 +refs/heads/master:refs/remotes/origin/master" returned status code 128:
      stdout: 
      stderr: remote: Repository not found.
      fatal: repository 'https://<GithubEnterpriseUrl>/<OrgName>/Packer.git/' not found
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1721)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:886)
      	... 8 more
      ERROR: Error fetching remote repo 'origin'
      [BFA] Scanning build for known causes...
      [BFA] No failure causes found
      [BFA] Done. 0s
      ERROR: Maximum checkout retry attempts reached, aborting
      Finished: FAILURE
      

      this is a multibranch job using the github plugin The credential I have selected above has write access to the repo and I have generated an OAuth token for this user which i have added to jenkins as a user/password type credential as per instruction for the plugin.

      I have also tried using the git plugin as a branch source but this produces the same error which leads me to believe its the git client. the fact it works when the repo is public suggests the credential is correct.

      Can someone help me troubleshoot this, perhaps there is additional config needed or a bug in the latest version?

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          Thanks. I tend to focus my Windows git efforts on testing recent releases of git. My current testing environment is 2.16.x and 2.17.x. When 2.18.x releases with support for git protocol 2, I'll switch most of my Windows machines to 2.18.0

          Show
          markewaite Mark Waite added a comment - Thanks. I tend to focus my Windows git efforts on testing recent releases of git. My current testing environment is 2.16.x and 2.17.x. When 2.18.x releases with support for git protocol 2, I'll switch most of my Windows machines to 2.18.0
          Hide
          mrhockeymonkey Scott Matthews added a comment -

          Ah indeed. Ill update my git and see if the same problems arise. it may very well be that to blame.

          Show
          mrhockeymonkey Scott Matthews added a comment - Ah indeed. Ill update my git and see if the same problems arise. it may very well be that to blame.
          Hide
          mrhockeymonkey Scott Matthews added a comment -

          I've just updated to git 2.17.1.windows.2 and the problem seems to persist.

          Show
          mrhockeymonkey Scott Matthews added a comment - I've just updated to git 2.17.1.windows.2 and the problem seems to persist.
          Hide
          mrhockeymonkey Scott Matthews added a comment -

          Sadly we have decommissioned our windows jenkins server so I'm not able to test this anymore. Happy for you to close the call if it cant be replicated your side. We have moved all our jobs to a linux master and run on a windows slave now and all is working as expected.

          Show
          mrhockeymonkey Scott Matthews added a comment - Sadly we have decommissioned our windows jenkins server so I'm not able to test this anymore. Happy for you to close the call if it cant be replicated your side. We have moved all our jobs to a linux master and run on a windows slave now and all is working as expected.
          Hide
          markewaite Mark Waite added a comment -

          Thanks Scott Matthews! If it is encountered again, we'll rely on someone to reopen this bug and provide more details.

          Show
          markewaite Mark Waite added a comment - Thanks Scott Matthews ! If it is encountered again, we'll rely on someone to reopen this bug and provide more details.

            People

            • Assignee:
              Unassigned
              Reporter:
              mrhockeymonkey Scott Matthews
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: