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

git credentials fail during check out, after fetching all branches

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Trivial Trivial
    • git-plugin
    • Jenkins casc 1.44
      github:1.30.0
      running in docker with jenkins/jenkins:2.249.2-lts-alpine

      A multibranch pipeline fails to checkout a submodule repo from an on-prem github using user/password credentials.

      The pipeline succeeds first getting all branches from the repo (using the username/password) but then next fail to pull that specific branch.

      Tried with a username/ssh key and git:// scheme, tried also with a https://username:password@ scheme. Each has the same failure.

      It's as if the username/password is forgotten after its first time use to fetch branch information.

      The error goes like this (sensitive parts are replaced):

      Branch indexing
       > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to https://github.private.com/Dep/project.git
       > git config remote.origin.url https://github.private.com/Dep/project.git # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
       > git --version # timeout=10
       > git --version # 'git version 2.26.2'
       > git config --get remote.origin.url # timeout=10
      using GIT_ASKPASS to set credentials Access github repo
       > git fetch --tags --force --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
      Seen branch in repository origin/Dep/add_submodule
      ... cut some lines here ...
      Seen 5 remote branches
      Obtained Jenkinsfile from 463f3d60c604e489e847e20f880942f4cdf68b0b
      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] Start of Pipeline
      [Pipeline] library
      Loading library jenkins-pipeline-test@Dep/add_submodule
      Attempting to resolve Dep/add_submodule from remote references...
       > git --version # timeout=10
       > git --version # 'git version 2.26.2'
       > git ls-remote -- https://github.private.com/Dep/project # timeout=10
      ERROR: Checkout failed
      hudson.plugins.git.GitException: Command "git ls-remote -- https://github.private.com/Dep/project" returned status code 128:
      stdout: 
      stderr: remote: Invalid username or password.
      fatal: Authentication failed for 'https://github.private.com/Dep/project/'
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1951)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1942)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRemoteReferences(CliGitAPIImpl.java:3381)
       at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:838)
       at jenkins.scm.api.SCMSource.fetch(SCMSource.java:636)
       at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.lambda$retrieve$0(SCMSourceRetriever.java:92)
       at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrySCMOperation(SCMSourceRetriever.java:107)
       at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:92)
       at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:157)
       at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:205)
       at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:154)
       at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
       at hudson.security.ACL.impersonate(ACL.java:367)
       at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
       at java.lang.Thread.run(Thread.java:748)
      [Pipeline] End of Pipeline
      ERROR: Maximum checkout retry attempts reached, aborting
      Finished: FAILURE
      

            Unassigned Unassigned
            jenkins_in_be F M
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: