Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git.exe init # timeout=10 ERROR: Error cloning remote repo 'origin' hudson.plugins.git

Tags:

devops

Need your help in resolving the below error.

I am able to run git clone command from my pc, but when I am trying to run it from jenkins I am getting below error.

Error:

Building in workspace C:\Tools\Jenkins\jobs\project A\workspace
Cloning the remote Git repository
Cloning repository [email protected]:scmgalaxy/helloworld-java-maven.git
 > git.exe init C:\Tools\Jenkins\jobs\project A\workspace # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init C:\Tools\Jenkins\jobs\project A\workspace
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:656)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:463)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1039)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1079)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Error performing command: git.exe init C:\Tools\Jenkins\jobs\project A\workspace
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1726)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1695)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1691)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1321)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:654)
    ... 12 more
Caused by: java.io.IOException: Cannot run program "git.exe" (in directory "C:\Tools\Jenkins\jobs\project A\workspace"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
    at hudson.Launcher$ProcStarter.start(Launcher.java:381)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1715)
    ... 16 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 22 more
ERROR: null
Finished: FAILURE
like image 725
Rama KrishnaPrasad Gopisetty Avatar asked Jun 28 '16 07:06

Rama KrishnaPrasad Gopisetty


People also ask

What is git init?

The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. Most other Git commands are not available outside of an initialized repository, so this is usually the first command you'll run in a new project.

What do I do after git init?

Once you have initialized the repository, create a remote repository somewhere like GitHub.com. Then, add the remote URL to your local git repository with git remote add origin <URL> .

Does git init create master branch?

By default, when you create a new project, git init will create a master branch. There's no option in git init to change this, but it's actually quite easy to set it up differently.


2 Answers

You have to set the path to git.exe in Jenkins:

  1. You have to go to http://yourjenkinsserver:8080/configureTools/

  2. There should be a field next to Path to Git executable.

  3. Put in that field the path to your C:\Program Files\Git\mingw64\bin\git.exe.

like image 185
devopsfun Avatar answered Sep 29 '22 18:09

devopsfun


Fix. 1. There is a space in project name. So removed the space. 2. There should be a field next to Path to Git executable 3. Put in that field the path to your git.exe. 4. Define JAVA_HOME

like image 23
Rama KrishnaPrasad Gopisetty Avatar answered Sep 29 '22 18:09

Rama KrishnaPrasad Gopisetty