Build failing on Windows with git commands

Hi. We’re running build with gradle 7.3.3 (and Java 11) and all is well on Linux, but it fails on windows at executing git commands. This is the build log:

$ ./gradlew clean

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'buying'.
Problem encountered while executing [git rev-parse --abbrev-ref HEAD] exitValue=[1] err=[]

When looking at the stacktrace, it comes down to running a git command: branchName = executeCommand(“git rev-parse --abbrev-ref HEAD”)
Only a few developer in our team are experiencing this issue. Any idea what could be causing the issue?

Thanks,
Alain

They probably don’t have git in their PATH while your build requires that.
Iirc with default setting of Git for Windows Git is only available inside “Git Bash” or “Git CMD”, not generally in the windows PATH.
You might want to consider changing your build, for example using the grgit Plugin which uses JGit under the hood and thus works independently from any installed Git command.
And you might also consider to cover the case that the build is not run from inside a Git repository, but for example from an export or source archive.