Franco
Franco

Reputation: 208

Error in mvn release with jenkins pipeline due to git permission

I have the following issue with jenkins pipeline, mvn release, git and sshagent:

Jenkinsfile

node {

    env.JAVA_HOME="${tool 'JDK-8u102'}"
    env.M2_HOME="${tool 'maven-3.3.9'}"
    env.PATH="${env.JAVA_HOME}/bin:${env.M2_HOME}/bin:${env.PATH}"

    stage "Checkout"
    git branch: 'master', credentialsId: '${gitCredentialsId}', url: '${gitUrl}'

    sshagent (['${gitCredentialsId}']) {
        sh "mvn -B -Dtag=${releaseVersion} release:prepare release:perform -DreleaseVersion=${releaseVersion} -DdevelopmentVersion=${developmentVersion}"
    }

}

Job Console Output

...

[ssh-agent] Using credentials scm
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent]   Java/JNR ssh-agent
[ssh-agent] Skipped registering BouncyCastle, not running on a remote agent
[ssh-agent] Started.

...

[ERROR] Provider message:
[ERROR] The git-tag command failed.
[ERROR] Command output:
[ERROR] 
[ERROR] *** Please tell me who you are.
[ERROR] 
[ERROR] Run
[ERROR] 
[ERROR] git config --global user.email "[email protected]"
[ERROR] git config --global user.name "Your Name"

The credentials are taken right but for some reason doesn't work with maven release. Any idea?

Upvotes: 0

Views: 1459

Answers (1)

Pom12
Pom12

Reputation: 7880

Like your stacktrace mentions it, you should configure an email and a name to your Git global config, e.g. :

sh 'git config --global user.email "[email protected]"'
sh 'git config --global user.name "Jenkins"'

Upvotes: 1

Related Questions