Hello everyone
I have Jenkins version Jenkins 2.375.2 Java version: jdk-11.0.16 running off my windows 10 laptop. I followed this tutorial to set up a pipeline using on-demand Ubuntu agents on the Google Cloud Platform:
I performed the “Hello World” test at the end to confirm that the set up works. I have also confirmed that git was successfully installed on the ubuntu agent with the path to the executable being /usr/bin/git. I tried running a new job that pulls code from a github public repo. I get this error whenever I try to run it:
Caused by: java.io.IOException: Cannot run program "C:\Program Files\Git\git-bash.exe" (in directory "/tmp/workspace/Hello_World_GCP"): error=2, No such file or directory
Under Global Tool Configuration → Git → Git Installations, I have the path to my git-bash executable entered as C:\Program Files\Git\git-bash.exe
Under Configure → Global Properties → Tool Locations I have put the path to the git executable on the ubuntu agent. The help message under Tool Locations says "You can specify the location of certain tools on this node, overriding the global configuration. (You may prefer to use automatic tool installers instead, removing the need to configure each node separately.) ", so I thought it would override the git-bash.exe but I still get the error.
Please any advice on how to solve this problem would be greatly appreciated.
it sure seems like C:\Program Files\Git\git-bash.exe doesn’t exist. If your agents are all ubuntu, then C:\Program Files\Git\git-bash.exe absolutely doen’t make sense as its a windows path. Maybe try deleting the override?
Hello @halkeye. Thanks for the response. I had tried initially without the override under Under Configure → Global Properties → Tool Locations but got the same error. It was that, that prompted me to add the override. I am new to Jenkins, so I am having trouble understanding why the ubuntu agent is looking for git at the windows path instead under Under Global Tool Configuration → Git → Git Installations instead of at /usr/bin/git under Configure → Global Properties → Tool . When I attempt to set the git path to /usr/bin/git under Under Global Tool Configuration → Git → Git Installations, Jenkins gives an error that the path does not exist, presumably because it is checking on the windows master and so it unsurprisingly does not find it. There must be way to inform the ubuntu agent to check for git at /usr/bin/git on the agent itself but I haven’t found how to do it.
That’s not the program that you want to use as the git installation. git-bash launches a bash shell in Windows in much the same way that cmd launches a command processor and powershell launches the Powershell Windows app.
You want git.exe as the git installation, not git-bash.exe.
If the computer using command line git is a Jenkins agent, you may want to install MinGit rather than installing the complete git for Windows. The MinGit page says:
MinGit is an intentionally minimal, non-interactive distribution of Git for Windows, with third-party applications as its intended audience.
More details about MinGit are available from a wiki page.
Thanks @MarkEWaite. I was realising my error right about the same time your message came in, but before I set the path to C:\Program Files\Git\git-bash.exe, the path was just set to git.exe and I got the same error. Having now realised my error, I looked up the proper path for git.exe which on my system is C:\Program Files\Git\cmd\git.exe and replaced C:\Program Files\Git\git-bash.exe with it but I am stil getting the same error.
You may be encountering JENKINS-54053. The workaround recommended in the comments on that issue report is to use “git” as the tool instead of “git.exe”