We are facing an issue while trying to clone the code from SCM on a macOS machine using Jenkins. The macOS machine is configured as an agent to build our Flutter application. However, Jenkins is throwing an error stating that the Git tool is set to “None”, preventing the cloning process.
Do you have git installed on that macOS machine and made it available in the path?
That is an informational message only, not an error. It does not prevent git operations. There is some other reason that is causing the job to not retrieve the repository from git. You’ll need to find that other reason. Usually it is included in the console log near the calls that perform git operations.
What is that informational message?
That informational message, “Git tool is set to …”, is displayed as part of git plugin performance enhancements. It can be disabled with a global setting as described in the git plugin documentation. That documentation says:
If JGit and command line git are both enabled on an agent, the git plugin uses a “git tool chooser” to choose a preferred git implementation. The preferred git implementation depends on the size of the repository and the git plugin features requested by the job. If the repository size is less than the JGit repository size threshold and the git features of the job are all implemented in JGit, then JGit is used. If the repository size is greater than the JGit repository size threshold or the job requires git features that are not implemented in JGit, then command line git is used.
If checked, the plugin will disable the feature that recommends a git implementation on the basis of the size of a repository. This switch may be used in case of a bug in the performance improvement feature. If you enable this setting, please report a git plugin issue that describes why you needed to enable it.
Git tool is set to “None” can show up even in successful pipelines. Could you share your pipeline and the exact error screenshots too and also share the agents and controller node information.
Make sure that the path is not overridden for the agent somehow. You can create a simple job to echo the environment and run it on the agent manually to check if something is getting overridden in the agent settings or similar.
Below is the result that I am getting on console output
Started by user Prasannakumar [Pipeline] Start of Pipeline [Pipeline] node Running on Mac-os in /Users/jenkins/workspace/Scribe-Ryte-Mobile [Pipeline] { [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Checkout) [Pipeline] withCredentials > git.exe --version # timeout=10 > git --version # ‘git version 2.41.0.windows.3’ Masking supported pattern matches of $GIT_PASSWORD or $GIT_ASKPASS [Pipeline] { [Pipeline] git The recommended git tool is: NONE using credential ScriberyteMobileGit Cloning the remote Git repository ERROR: Error cloning remote repo ‘origin’
There has to be more. Give the whole output dont cut it off
Looks like you are trying to run a window git.exe on mac.
The odd thing is that it shows the version after that? I would think it would just die a horrible death.
Yes, that is what I would also expect, but in the screenshot he has a /usr/bin/git which seems more appropriate. Maybe a global tool /setting that would need an override on mac?
"I am running Jenkins on Windows, and macOS is running as an agent. I am trying to build an iOS application and attempting to clone the code from Git, but I am unable to do so. I am getting the following error, even though everything looks fine. Below is the screenshot of the console output.
git.exe init /Users/jenkins/workspace/Scribe-Ryte-Mobile # timeout=10
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error cloning remote repo ‘origin’
G:\Jenkins.jenkins\workspace\Scribe-Ryte-Mobile@tmp\jfrog\192.jfrog deleted
Finished: FAILURE
I think that you’re encountering JENKINS-54053. When the controller is Windows based, the git tool on agents defaults to “git.exe” unless the controller configuration is changed to make the system default “git”. The workaround described in that issue still works as far as I know. It says:
I found a workaround:
“Manage Jenkins” → “Global Tool Configuration” → Git
only “git” without path.
You could also set it in the node properties for the agent.
The issue got fixed …Thank you all