How can I unset an env variable in a Exec task?

One option is to write a shell script that unsets the environment variable and runs Git, and invoke that script from the ‘Exec’ task. Another option might be to use one of the third-party Gradle SCM plugins to interact with Git.