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

Git fails to fetch from private repo when credentials manager enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • git-client-plugin
    • None
    • Jenkins 2.121.1 (as a windows service)
      git plugin 3.9.1

      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?

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

              Created:
              Updated:
              Resolved: