ERROR: Error fetching remote repo 'origin' Failed to setup credentials

I am using auth token from github to access my github repo, i am able to do it locally in my linux machine using the same auth token. So the token is not the issue here. However, jenkins just Failed to setup credentials, and I am unable to figure out why. Anything will help.

Thanks

Summary

14:31:51 > git --version # timeout=10 14:31:51 > git --version # ‘git version 2.25.1’ 14:31:51 using GIT_ASKPASS to set credentials TheoPatToken 14:31:51 ERROR: Error fetching remote repo ‘origin’ 14:31:51 hudson.plugins.git.GitException: Failed to fetch from repo · GitHub 14:31:51 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999) 14:31:51 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241) 14:31:51 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305) 14:31:51 at hudson.scm.SCM.checkout(SCM.java:540) 14:31:51 at hudson.model.AbstractProject.checkout(AbstractProject.java:1248) 14:31:51 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649) 14:31:51 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) 14:31:51 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521) 14:31:51 at hudson.model.Run.execute(Run.java:1895) 14:31:51 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) 14:31:51 at hudson.model.ResourceController.execute(ResourceController.java:101) 14:31:51 at hudson.model.Executor.run(Executor.java:442) 14:31:51 Caused by: hudson.plugins.git.GitException: Failed to setup credentials 14:31:51 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2187) 14:31:51 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635) 14:31:51 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:170) 14:31:51 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161) 14:31:51 at hudson.remoting.UserRequest.perform(UserRequest.java:211) 14:31:51 at hudson.remoting.UserRequest.perform(UserRequest.java:54) 14:31:51 at hudson.remoting.Request$2.run(Request.java:377) 14:31:51 at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) 14:31:51 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 14:31:51 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 14:31:51 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 14:31:51 at java.base/java.lang.Thread.run(Thread.java:840) 14:31:51 Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to Theo_node 14:31:51 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787) 14:31:51 at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356) 14:31:51 at hudson.remoting.Channel.call(Channel.java:1003) 14:31:51 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:153) 14:31:51 at jdk.internal.reflect.GeneratedMethodAccessor875.invoke(Unknown Source) 14:31:51 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 14:31:51 at java.base/java.lang.reflect.Method.invoke(Method.java:568) 14:31:51 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:138) 14:31:51 at jdk.proxy114/jdk.proxy114.$Proxy204.execute(Unknown Source) 14:31:51 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997) 14:31:51 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241) 14:31:51 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305) 14:31:51 at hudson.scm.SCM.checkout(SCM.java:540) 14:31:51 at hudson.model.AbstractProject.checkout(AbstractProject.java:1248) 14:31:51 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649) 14:31:51 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) 14:31:51 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521) 14:31:51 at hudson.model.Run.execute(Run.java:1895) 14:31:51 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) 14:31:51 at hudson.model.ResourceController.execute(ResourceController.java:101) 14:31:51 at hudson.model.Executor.run(Executor.java:442) 14:31:51 Caused by: java.io.IOException: Cannot run program “cp”: error=2, No such file or directory 14:31:51 at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143) 14:31:51 at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073) 14:31:51 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createNonBusyExecutable(CliGitAPIImpl.java:2743) 14:31:51 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createUnixStandardAskpass(CliGitAPIImpl.java:2520) 14:31:51 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2145) 14:31:51 … 11 more 14:31:51 Caused by: java.io.IOException: error=2, No such file or directory 14:31:51 at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) 14:31:51 at java.base/java.lang.ProcessImpl.(ProcessImpl.java:314) 14:31:51 at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244) 14:31:51 at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110) 14:31:51 … 15 more 14:31:51 ERROR: Error fetching remote repo ‘origin’

Hello @TheoWan1, and welcome to this community. :wave:

The error message Cannot run program "cp": error=2, No such file or directory indicates that the cp command is not found on the Jenkins node where the job is running. :person_shrugging:

This is likely causing the failure to set up credentials.