Can not execute the Git commands of the Gradle build script on Windows 10


I have recently forked and cloned a repositroy from GitHub that uses Gradle, but I am unable to execute any Gradle tasks.

It fails on:

def process = 'git rev-parse --short HEAD'.execute()


FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Joseph\Desktop\Minecraft\ObsidianSuite\ForgeGradle\ForgeGradle\build.gradle' line: 286

* What went wrong:
A problem occurred evaluating root project 'ForgeGradle'.
> Cannot run program "git": CreateProcess error=2, The system cannot find the file specified

I am running Windows 10, and have Git working with MinGW. I have set the path variable to include (C:\Program Files\Git\cmd) such that I can run Git from command prompt. The Git command that is called by the build.gradle file executes fine if I run it from the command line, it is just not working when run through the Gradle wrapper.

Any help or advice would be much appreciated; I am able to answer any questions that might help work out what the issue is. Thanks.

EDIT: I normally use Git by running git-bash in the relevant folder rather than git from command prompt.

Please, don't call executables from Java/Groovy/Gradle/etc. There are many java/groovy libraries to deal with Git repositories, including Gradle plugins