问题
I'm trying to incorporate Jenkins Maven Release plugin with Git and the job is failing because it can't find the git executable.
My git repo is setup with ssh and I can execute the Git command on the Jenkins server. I can run a build using Jenkins and everything is pulled down from the Git repo successfully.
But when I try to do a release, Jenkins fails to find the git command. What am I doing wrong?
Jenkins Info:
- Version 1.504
- Git Plugin 1.2.0
- Git Client Plugin 1.0.3
- Running on Windows Server 2008
Git Installed on the Windows server - 1.8.1.msysgit.1
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.305s
[INFO] Finished at: Tue Mar 05 12:26:22 CST 2013
[INFO] Final Memory: 10M/168M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving C:\Users\svctpsolap\jenkins_home\jobs\NBEntity\workspace\nbentity\pom.xml to C:\Users\svctpsolap\jenkins_home\jobs\NBEntity\modules\com.nb$nbentity\builds\2013-03-05_13-26-05\archive\com.nb\nbentity\0.0.1-SNAPSHOT\nbentity-0.0.1-SNAPSHOT.pom
Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project nbentity: Unable to commit files
Provider message:
The git-add command failed.
Command output:
'git' is not recognized as an internal or external command,
operable program or batch file.
回答1:
Add the path to the git.cmd
to the system PATH
environment. Then restart Windows to take effect (restarting the Jenkins service alone is not enough).
来源:https://stackoverflow.com/questions/15231613/jenkins-git-release-failure