Having trouble with Git SCM checkout / cloning repository with multi-branch pipelines running on Windows agents

The Jenkins agent tried to use the program /usr/local/bin/git as the git program. It could not find it. It could not find it because there is no program /usr/local/bin/git on your Windows agent.

Your choices are:

  • Enable JGit so that you don’t need to install git on Windows. This works well with repositories less than 50 MB. Repositories over 100MB are better handled by command line git
  • Install MinGit on your Windows agent and configure the PATH on the Windows agent so that it can find MinGit. The MinGit implementation is well suited to CI agent use cases. It does not have many of the user centered features of git for Windows
  • Install git for windows on the Windows agent and configure the PATH on the agent so that it can find Windows git
  • Define a global tool that will install MinGit on your Windows agent, then reference the tool in your Jenkinsfile
  • Define a global tool that will install git for Windows (or PortableGit), then reference the tool in your Jenkinsfile

My preferred solution is to install MinGit on the Windows agent so that I don’t waste time downloading the tool each time the agent is reset.