How to Configure Jenkins for Git Merge?

Article ID:227246387
1 minute readKnowledge base

Issue

  • I am using the functionality that automatically merges branches from Jenkins (Git Plugin

  • When doing the merge/push, my build fails with a stack trace similar to:

 Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git merge ..." returned status code 128:
 stdout:
 stderr:
 *** Please tell me who you are.
 Run
 git config --global user.email "you@example.com"
 git config --global user.name "Your Name"
 to set your account's default identity.
 Omit --global to set the identity only in this repository.
 fatal: empty ident <jenkins@localhost> not allowed

Resolution

When doing a push, git needs user information to push anything. This can be configured in Jenkins either Globally or per Project.

Global Configuration

In the global configuration under Manage Jenkins  Configure System  Git Plugin:

global git config

Project Configuration

In the project configuration, under Source Code Management  Git  Additional Behaviours, you can add the behaviour Custom user name/email address:

additional behavior git config