Gradle release does not allow to configure the git credentials. Even this question is unnecesary I will put two different possibilities to sort this out because I was struggling all the day with this. Why? Because I am not allowed to use SSH anymore in the company and we are moving to docker containers to distribute our CI pipelines:
1.) Put the SSH key under user jenkins ~/.ssh/id_rsa as it is explained here
2.) Use "Execute shell" before the gradle release to configure the remote:

Token must be configured as an environment variable. This to answer the initial question.
3.) More advance functionalities can be included with the use of pipelines. I put below the Jenkinsfile to execute gradle release (you can use also sshagent (credentials: ['credential'])
and then you do not need the git stuff):
// GITLAB_API_TOKEN
withCredentials([string(credentialsId: 'nexususer', variable: 'nexusUsername'),
string(credentialsId: 'nexuspassword', variable: 'nexusPassword'),
string(credentialsId: 'nexussnapshoturl', variable: 'nexusSnapshotUrl'),
string(credentialsId: 'nexusreleaseurl', variable: 'nexusReleaseUrl'),
string(credentialsId: 'token', variable: 'GITLAB_API_TOKEN')]) {
if (env.BRANCH_NAME == "master") {
stage('Release') {
gitlabCommitStatus(name: 'Release') {
// Run the gradle release
sh 'git config user.email "email"'
sh 'git config user.name "name"'
sh "git remote rm origin"
sh "git remote add origin https://username:${GITLAB_API_TOKEN}@yourrepo"
sh "gradle clean release -Prelease.useAutomaticVersion=true"
}
}
}
}