Jenkins could not run git
Also you can set Git location in Jenkins server/node configuration:
goto Configure, under section Node Properties mark checkbox Tools Location and set yours path to Git.
It seems Jenkins has been changing a lot. I fixed this problem in March 2017 by doing this:
- Go to Manage Jenkins
- Go to Global Tool Configuration
- In
Git / Path to Git executable
enterC:\<whatever the path is>\git.exe
. - Click on Save.
The solution for me was to set the git path in the Manage Jenkins > Global Tool Configuration settings. In the Git section, I changed the Path to Git executable to /usr/local/bin/git
.
I had similar problem, the solution for Windows looks the same (my Jenkins is installed on a Windows machine):
Global settings:
Go to Manage jenkins -> Configure System -> Git installations
add there the git exe path (for example: C:\Program Files\Git\bin\git.exe
), or you can use environment variable.
For Jenkins version 2.121.3, Go to Manage jenkins -> Global tool configuration -> Git installations -> Path to Git executable: C:\Program Files\Git\bin\git.exe
Jenkins job side:
Go to Source code Management -> select git, add your repository, choose connection to repository (http/ssh) and add credentials and it should work.