• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • git-plugin
    • Jenkins version : 2.46.3
      All plugins with latest version (credentials/global parameters/git/github)

      I am executing below pipeline script 

      #!groovy
      
      node("jenkins-slave") {
       try {
       stage("Checkout") { 
       checkout([$class: 'GitSCM',
       branches: [[name: 'test']], 
       doGenerateSubmoduleConfigurations: false, 
       userRemoteConfigs: [[
       credentialsId: "${env.GITHUB_CREDENTIAL_ID}",
       url: "github.azc.abc.com/test/test.git"
       ]]]
       )
       }
       } catch (error) {
       throw error
       }
      
      stage("print") {
       sh "echo 'hello world'"
       }
      }
      

       

      It fails with below error

       

      Started by user anonymous
      [Pipeline] node
      Running on jenkins-slave in /opt/mount1/jenkins/workspace/pipeline-github-test
      [Pipeline] \{
      [Pipeline] stage
      [Pipeline] \{ (Checkout)
      [Pipeline] checkout
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url https://github.azc.abc.com/test/test.git # timeout=10
      Fetching upstream changes from https://github.azc.abc.com/test/test.git
       > git --version # timeout=10
       > git fetch --tags --progress https://github.azc.abc.com/test/test.git +refs/heads/*:refs/remotes/origin/*
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from https://github.azc.abc.com/test/test.git
       at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:812)
       at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1079)
       at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1110)
       at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
       at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
       at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
       at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
       at hudson.security.ACL.impersonate(ACL.java:260)
       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:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at java.lang.Thread.run(Thread.java:748)
      Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://github.azc.abc.com/test/test.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: error: The requested URL returned error: 403 Forbidden while accessing https://github.azc.abc.com/test/test.git/info/refs
      
      fatal: HTTP request failed
      
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
       at hudson.remoting.UserRequest.perform(UserRequest.java:153)
       at hudson.remoting.UserRequest.perform(UserRequest.java:50)
       at hudson.remoting.Request$2.run(Request.java:336)
       at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at java.lang.Thread.run(Thread.java:748)
       at ......remote call to jenkins-slave(Native Method)
       at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
       at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
       at hudson.remoting.Channel.call(Channel.java:830)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
       at com.sun.proxy.$Proxy79.execute(Unknown Source)
       at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
       ... 13 more
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: Error fetching remote repo 'origin'
      Finished: FAILURE
      

          [JENKINS-45418] Credential user with git clone is failing

          Maneesh M P created issue -
          Maneesh M P made changes -
          Epic Link New: JENKINS-31152 [ 165808 ]

          Maneesh M P added a comment -

          This fails with freestyle job as well

          Maneesh M P added a comment - This fails with freestyle job as well

          Maneesh M P added a comment -

          Issue is observed only while running the job on slave, master it works fine

          Maneesh M P added a comment - Issue is observed only while running the job on slave, master it works fine
          Stephen Connolly made changes -
          Component/s New: git-plugin [ 15543 ]
          Component/s Original: credentials-plugin [ 16523 ]
          Component/s Original: git-client-plugin [ 17423 ]
          Component/s Original: github-api-plugin [ 17496 ]
          Stephen Connolly made changes -
          Assignee Original: Stephen Connolly [ stephenconnolly ] New: Mark Waite [ markewaite ]
          Mark Waite made changes -
          Description Original:  

           

          I am executing below pipeline script 

          #!groovy

          node("jenkins-slave") \{
           try \{
           stage("Checkout") \{
           checkout([$class: 'GitSCM',
           branches: [[name: 'test']],
           doGenerateSubmoduleConfigurations: false,
           userRemoteConfigs: [[
           credentialsId: "$\{env.GITHUB_CREDENTIAL_ID}",
           url: "github.azc.abc.com/test/test.git"
           ]]]
           )
           }
           } catch (error) \{
           throw error
           }

          stage("print") \{
           sh "echo 'hello world'"
           }
          }

           

          It fails with below error

           

          Started by user anonymous
          [Pipeline] node
          Running on jenkins-slave in /opt/mount1/jenkins/workspace/pipeline-github-test
          [Pipeline] \{
          [Pipeline] stage
          [Pipeline] \{ (Checkout)
          [Pipeline] checkout
           > git rev-parse --is-inside-work-tree # timeout=10
          Fetching changes from the remote Git repository
           > git config remote.origin.url https://github.azc.abc.com/test/test.git # timeout=10
          Fetching upstream changes from https://github.azc.abc.com/test/test.git
           > git --version # timeout=10
           > git fetch --tags --progress https://github.azc.abc.com/test/test.git +refs/heads/*:refs/remotes/origin/*
          ERROR: Error fetching remote repo 'origin'
          hudson.plugins.git.GitException: Failed to fetch from https://github.azc.abc.com/test/test.git
           at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:812)
           at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1079)
           at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1110)
           at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
           at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
           at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
           at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
           at hudson.security.ACL.impersonate(ACL.java:260)
           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:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at java.lang.Thread.run(Thread.java:748)
          Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://github.azc.abc.com/test/test.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: error: The requested URL returned error: 403 Forbidden while accessing https://github.azc.abc.com/test/test.git/info/refs

          fatal: HTTP request failed

          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903)
           at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622)
           at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
           at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
           at hudson.remoting.UserRequest.perform(UserRequest.java:153)
           at hudson.remoting.UserRequest.perform(UserRequest.java:50)
           at hudson.remoting.Request$2.run(Request.java:336)
           at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at java.lang.Thread.run(Thread.java:748)
           at ......remote call to jenkins-slave(Native Method)
           at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
           at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
           at hudson.remoting.Channel.call(Channel.java:830)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
           at com.sun.proxy.$Proxy79.execute(Unknown Source)
           at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
           ... 13 more
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          ERROR: Error fetching remote repo 'origin'
          Finished: FAILURE
          New: I am executing below pipeline script 


          {noformat}
          #!groovy

          node("jenkins-slave") {
           try {
           stage("Checkout") {
           checkout([$class: 'GitSCM',
           branches: [[name: 'test']],
           doGenerateSubmoduleConfigurations: false,
           userRemoteConfigs: [[
           credentialsId: "${env.GITHUB_CREDENTIAL_ID}",
           url: "github.azc.abc.com/test/test.git"
           ]]]
           )
           }
           } catch (error) {
           throw error
           }

          stage("print") {
           sh "echo 'hello world'"
           }
          }
          {noformat}

           

          It fails with below error

           


          {noformat}
          Started by user anonymous
          [Pipeline] node
          Running on jenkins-slave in /opt/mount1/jenkins/workspace/pipeline-github-test
          [Pipeline] \{
          [Pipeline] stage
          [Pipeline] \{ (Checkout)
          [Pipeline] checkout
           > git rev-parse --is-inside-work-tree # timeout=10
          Fetching changes from the remote Git repository
           > git config remote.origin.url https://github.azc.abc.com/test/test.git # timeout=10
          Fetching upstream changes from https://github.azc.abc.com/test/test.git
           > git --version # timeout=10
           > git fetch --tags --progress https://github.azc.abc.com/test/test.git +refs/heads/*:refs/remotes/origin/*
          ERROR: Error fetching remote repo 'origin'
          hudson.plugins.git.GitException: Failed to fetch from https://github.azc.abc.com/test/test.git
           at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:812)
           at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1079)
           at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1110)
           at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
           at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
           at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
           at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
           at hudson.security.ACL.impersonate(ACL.java:260)
           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:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at java.lang.Thread.run(Thread.java:748)
          Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://github.azc.abc.com/test/test.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: error: The requested URL returned error: 403 Forbidden while accessing https://github.azc.abc.com/test/test.git/info/refs

          fatal: HTTP request failed

          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903)
           at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622)
           at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
           at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
           at hudson.remoting.UserRequest.perform(UserRequest.java:153)
           at hudson.remoting.UserRequest.perform(UserRequest.java:50)
           at hudson.remoting.Request$2.run(Request.java:336)
           at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           at java.lang.Thread.run(Thread.java:748)
           at ......remote call to jenkins-slave(Native Method)
           at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
           at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
           at hudson.remoting.Channel.call(Channel.java:830)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
           at com.sun.proxy.$Proxy79.execute(Unknown Source)
           at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
           ... 13 more
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          ERROR: Error fetching remote repo 'origin'
          Finished: FAILURE
          {noformat}
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]

          Mark Waite added a comment - - edited

          I think this may be a user misunderstanding. Have you placed diagnostic print statements into your pipeline script to show the value of

          "${env.GITHUB_CREDENTIALS_ID}"
          

          on the agent where it is failing? I suspect that environment variable is not defined on that agent, and that is what is causing the failure.

          In general, authentication "bug reports" are usually not bugs, but rather configuration mistakes. If that environment variable is available on the agent, then please provide more detail of the agent platform (windows as a user, windows as a service, CentOS linux, Debian linux, Ubuntu linux, aix, FreeBSD, etc.), git version on the agent platform, and if there are any "interesting" characters in either the username or the password.

          Mark Waite added a comment - - edited I think this may be a user misunderstanding. Have you placed diagnostic print statements into your pipeline script to show the value of "${env.GITHUB_CREDENTIALS_ID}" on the agent where it is failing? I suspect that environment variable is not defined on that agent, and that is what is causing the failure. In general, authentication "bug reports" are usually not bugs, but rather configuration mistakes. If that environment variable is available on the agent, then please provide more detail of the agent platform (windows as a user, windows as a service, CentOS linux, Debian linux, Ubuntu linux, aix, FreeBSD, etc.), git version on the agent platform, and if there are any "interesting" characters in either the username or the password.

          Maneesh M P added a comment -

          I have the GITHUB_CREDENTIALS_ID defined both in global configuration and on the slave configuration. I can post the screenshot if you would like

           

          Maneesh M P added a comment - I have the GITHUB_CREDENTIALS_ID defined both in global configuration and on the slave configuration. I can post the screenshot if you would like  

            Unassigned Unassigned
            maneeshmp Maneesh M P
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: