Unable to do my first ever build in Jenkins (using git as the source control)

3,035 views
Skip to first unread message

ramagopr

unread,
Feb 13, 2016, 6:13:07 PM2/13/16
to Jenkins Users
Hi , I am trying to do my first build in Jenkins using git as the source control. Just a simple "HelloWorld.java". Getting the following error. Can't comprehend why. I have got my "%PATH%" correct. But still this thing doesn't work. Kindly help.

Started by user anonymous
Building in workspace C:\Users\DELL\.jenkins\jobs\Helloworld\workspace
 > git.exe rev-parse --is-inside-work-tree # timeout=10
ERROR: Workspace has a .git repository, but it appears to be corrupt.
hudson.plugins.git.GitException: Error performing command: git.exe rev-parse --is-inside-work-tree
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1717)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1686)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1682)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1312)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1324)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.hasGitRepo(CliGitAPIImpl.java:195)
	at hudson.plugins.git.GitAPI.hasGitRepo(GitAPI.java:232)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:998)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
	at hudson.scm.SCM.checkout(SCM.java:485)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
	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: java.io.IOException: Cannot run program "git.exe" (in directory "C:\Users\DELL\.jenkins\jobs\Helloworld\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:1706)
	... 17 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)
	... 23 more
Cloning the remote Git repository
Cloning repository https://github.com/ramagopr1/programs
 > git.exe init C:\Users\DELL\.jenkins\jobs\Helloworld\workspace # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init C:\Users\DELL\.jenkins\jobs\Helloworld\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:1013)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
	at hudson.scm.SCM.checkout(SCM.java:485)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
	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:\Users\DELL\.jenkins\jobs\Helloworld\workspace
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1717)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1686)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1682)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1312)
	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:\Users\DELL\.jenkins\jobs\Helloworld\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:1706)
	... 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

Mark Waite

unread,
Feb 13, 2016, 8:12:34 PM2/13/16
to Jenkins Users
The exception says "The system cannot find the file specified".  That usually would indicate that your PATH is not set to include the git.exe program.

You said that your PATH is set correctly, but didn't include the value of the PATH as seen by the Jenkins job.  You can see that value by creating a job which runs a Windows batch build step and performs "ECHO %PATH%"

If you chose Windows defaults for your installation of git on your Windows machine, it should be in C:\Program Files\Git\bin\git.exe .  Set that as the git path in the node configuration, or assure that C:\Program Files\Git\bin is in your PATH.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/80953aa9-86c1-4dd0-a324-0a208638ae5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ramagopr

unread,
Feb 13, 2016, 8:34:02 PM2/13/16
to Jenkins Users
Thanks Mark for your help. I can see the bin directory in the path specified. Please find attached the screenshot.
screenshot.PNG

ramagopr

unread,
Feb 13, 2016, 8:43:42 PM2/13/16
to Jenkins Users
Also have added the echo %PATH% step as a separate build step which doesn't seem to have any effect at all. The console output doesn't show the output of echo %PATH% at all. Weird.
Capture1.PNG

Mark Waite

unread,
Feb 13, 2016, 8:55:51 PM2/13/16
to Jenkins Users
Adding it as a separate build step in a job which fails to clone from the git repository probably won't even run that build step, since the clone failed.

You can see that value by creating a new job which runs a Windows batch build step and performs "ECHO %PATH%".

If you used "Manage Jenkins" / "Configure System" (http://localhost:8080/configure) to set the location of the git executable, you may need to correct that so that either it is "git", or points to precisely the git executable.  If you'll be using slave nodes, you probably want it to be "git", since some of your slaves may not be Windows.

If you are running a slave and configured the git location incorrectly in the slave configuration, you will need to correct that.

Mark Waite

ramagopr

unread,
Feb 13, 2016, 8:58:38 PM2/13/16
to Jenkins Users
Hi Mark,

I changed the system configuration to include the path. Now i get an "access denied" error.
Please find attached the screenshot.

Capture2.PNG

Mark Waite

unread,
Feb 13, 2016, 9:04:58 PM2/13/16
to Jenkins Users
You listed the directory which contains the git program (C:\Program Files\Git\bin) rather than the path to the git program (C:\Program Files\Git\bin\git.exe).  At least, the output of the command says that it is trying to execute "C:\Program Files\Git\bin" as though it were a program.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

ramagopr

unread,
Feb 13, 2016, 9:11:47 PM2/13/16
to Jenkins Users
Thanks a ton Mark. I changed the path to include the git executable as suggested by you and it worked. 

all success now.

regards,
Ram
capture3.PNG

ramagopr

unread,
Feb 14, 2016, 2:14:18 AM2/14/16
to Jenkins Users
Hi Mark,

Now i get an error in the unit test step using ANT.

[22] $ cmd.exe /C '"ant.bat -file build.xml NewHome && exit %%ERRORLEVEL%%"'
'ant.bat' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Invoke Ant' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE

Mark Waite

unread,
Feb 14, 2016, 6:57:21 AM2/14/16
to Jenkins Users

You need to install ant on that computer. Jenkins can do that for you. Use a Google search for the video "Jenkins in five minutes". It will show you how to configure automatic install of ant.


Reply all
Reply to author
Forward
0 new messages