How to Configure Jenkins for Git Merge?

Issue

  • I am using the functionality that automatically merge branch from Jenkins (Git Plugin and/or Validate Merge Plugin)
  • When doing the merge/push my build fail a stacktrace similar to:
 Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git merge qwertyuiopasdfghjklzxcvbnm" 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

Environment

Resolution

When doing a push, git needs user information to be able 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:

Project Configuration

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

Validate Merge Access Control (For Validate Merge Plugin only)

When using validate merge, you can specify which user/credentials to use for logging to the remote host. For example, you can use*Username/Password credentials and specify your GitHub API Token as password:

For more information, please have a look at Validate Merge Plugin - Pushing to the upstream repository

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.