Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins picks wrong git binary

I have a Jenkins server (version 2.150.2) running on Oracle Linux 6.9. Git 1.7.1 is installed on server and binary available under /usr/bin/git (shows upon running which git command).

My Windows slave is connected to this master and git is configured here as well. Still I am getting the following error:

Caused by: java.io.IOException: Cannot run program "/usr/bin/git" (in directory "C:\Jenkins\workspace\x\y\z"): CreateProcess error=2, The system cannot find the file specified

Tried upgrading all plugins and restarting Jenkins to no avail.

Somehow, the Jenkins git plugin is picking up the server git path instead of node. This is evident from console log:

...
15:17:07 Cloning the remote Git repository
15:17:08 Cloning repository xxx
15:17:09  > /usr/bin/git init C:\Jenkins\workspace\TestJobs\xxx\xxx # timeout=10
...

My Jenkins Git configurations:

  • Node (Windows) Git mentioned under Tool Locations:

enter image description here

  • Server (Linux) Git mentioned under Global Tool Configuration:

enter image description here

like image 724
Saikat Avatar asked Jun 20 '26 05:06

Saikat


1 Answers

You need to configure Git tool in the Manage Jenkins -> Manage Nodes -> YOUR_NODE_NAME -> Configure page. In Node Properties section you must enable Tool Locations and then add Git tool location (you need to specify Home as for Git installed on your node).

like image 123
biruk1230 Avatar answered Jun 21 '26 20:06

biruk1230



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!