My problem was slightly different, but my solution also applies for this question here. Jenkins Poll SCM (Git) on Windows master / Build on Linux slave
When using the "Git installations" option, you will need to create different jobs, one with each Git Installation. Modifying the PATH either on windows or linux, sometimes might not be an option (in my case, I only have access to Jenkins web UI).
Instead, just make the Default Git installation to point to whatever the Master git installation is (e.g. c:\apps\git\bin\git.exe
), and then configure the custom "Tool Locations" for each node. This way you can run the same jenkins job in different master/slave OS. Steps:
- Manage Jenkins > Manage Nodes
- For each node having git location other than the one provided in the "Git installation", do:
2.1 Open node configuration page (Configure icon)
2.2 Check "Tool Locations" if not already checked
2.3 Click "Add"
2.4 Select "(Git) Default" on the dropdown
2.5 Enter the path to the slave node git installation (e.g.
/usr/local/bin/git
)
2.6 Save
- Repeat steps 2.1 to 2.5 for each Linux slave the job may run.
Node configuration on linux should look something like this:

I believe the additional "git installations" are more suitable, as @Jayan mentioned, when you need to have multiple git installations or you need to run, for some reason, a specific version of git for select Jenkins jobs.