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

java.io.IOException: Cannot run program "git" (in directory "/home/jenkins/workspace/pipeline"): error=2, No such file or directory

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Blocker Blocker
    • docker-plugin
    • None
    • CoreOS
      Docker Image :evarga/jenkins-slave

      A Docker Pipeline with Cloud>Docker is not able to run a Jenkins pipeline in the Docker container provisioned on a different CoreOS instance. Docker container gets provisioned but build generates the following error.

      {{ERROR: Error cloning remote repo 'origin'
      hudson.plugins.git.GitException: Could not init /home/jenkins/workspace/docker-plugin-pipeline

      Caused by: java.io.IOException: Cannot run program "git" (in directory "/home/jenkins/workspace/docker-plugin-pipeline"): error=2, No such file or directory}}

      Configuring a different PATH for git /usr/bin/git in Configure System does not fix the issue.

          [JENKINS-40192] java.io.IOException: Cannot run program "git" (in directory "/home/jenkins/workspace/pipeline"): error=2, No such file or directory

          `Cannot run program "git" No such file or directory`

          Do you have git installed in docker image used as build agent ?

          Nicolas De Loof added a comment - `Cannot run program "git" No such file or directory` Do you have git installed in docker image used as build agent ?

          Please create a test job without SCM, and a shell script build step to run diagnostic commands:

          which git

          echo $PATH

          Nicolas De Loof added a comment - Please create a test job without SCM, and a shell script build step to run diagnostic commands: which git echo $PATH

          dvohra ping

          Nicolas De Loof added a comment - dvohra ping

          ndeloof same issue happens to me.

          I checked which git and echo $PATH they seem ok, i alse checked echo git --help it shows the help instructions but the error still be there like:

           
          ERROR: Error cloning remote repo 'origin'
          hudson.plugins.git.GitException: Could not init /var/lib/jenkins/workspace/blutv.com.tr/develop
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:772)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:564)
          at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1120)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:290)
          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)
          Caused by: hudson.plugins.git.GitException: Error performing command: git init /var/lib/jenkins/workspace/blutv.com.tr/develop
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2003)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1964)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1960)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1597)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:770)
          ... 14 more
          Caused by: java.io.IOException: Cannot run program "git" (in directory "/var/lib/jenkins/workspace/blutv.com.tr/develop"): error=2, No such file or directory
          at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
          at hudson.Proc$LocalProc.<init>(Proc.java:249)
          at hudson.Proc$LocalProc.<init>(Proc.java:218)
          at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
          at hudson.Launcher$ProcStarter.start(Launcher.java:449)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1992)
          ... 18 more
          Caused by: java.io.IOException: error=2, No such file or directory
          at java.lang.UNIXProcess.forkAndExec(Native Method)
          at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
          at java.lang.ProcessImpl.start(ProcessImpl.java:134)
          at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
          ... 23 more

          Huseyin Yurtseven added a comment - ndeloof  same issue happens to me. I checked which git and echo $PATH they seem ok, i alse checked echo git --help it shows the help instructions but the error still be there like:   ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Could not init /var/lib/jenkins/workspace/blutv.com.tr/develop at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:772) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:564) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1120) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) 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) Caused by: hudson.plugins.git.GitException: Error performing command: git init /var/lib/jenkins/workspace/blutv.com.tr/develop at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2003) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1964) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1960) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1597) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:770) ... 14 more Caused by: java.io.IOException: Cannot run program "git" (in directory "/var/lib/jenkins/workspace/blutv.com.tr/develop"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at hudson.Proc$LocalProc.<init>(Proc.java:249) at hudson.Proc$LocalProc.<init>(Proc.java:218) at hudson.Launcher$LocalLauncher.launch(Launcher.java:929) at hudson.Launcher$ProcStarter.start(Launcher.java:449) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1992) ... 18 more Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 23 more

          Hi,

          I solve the problem, the problem was git was not installed on the jenkins machine, i thought it runs in docker container but as far as i see it runs on the host machine, so after i installed git on the host machine everything works fine.

          Thank you

          Huseyin Yurtseven added a comment - Hi, I solve the problem, the problem was git was not installed on the jenkins machine, i thought it runs in docker container but as far as i see it runs on the host machine, so after i installed git on the host machine everything works fine. Thank you

            Unassigned Unassigned
            dvohra Deepak Vohra
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: