Merging a pull request with 'rebase and fast-forward' strategy fails with merge conflict in Bitbucket Server

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Merging a pull request with 'rebase and fast-forward' strategy gives merge conflict error in Bitbucket server. However, there is no actual conflict within commits as they are empty. The pull request can be merged with a different merge strategy without issues. 
On the UI, it errors with 

The merge could not be completed automatically. Please clone 'project/repo, checkout 'branch_1' and merge 'branch_2' (or commit 'commit_hash_2') manually, resolving any conflicts, and push the result.

Environment

Bitbucket server / Datacenter 6.10.0

Git on the server was built from the source

Diagnosis

From Bitbucket logs, we see the merge operation fails with 

com.atlassian.bitbucket.scm.MergeException: The merge could not be completed automatically. Please clone '<PROJ/REPOSITORY>', checkout '<BRANCH1>' and merge '<BRANCH2>' (or commit '<commit-hash>') manually, resolving any conflicts, and push the result.
.
Caused by: com.atlassian.bitbucket.scm.CommandFailedException: '/opt/git/git_current/bin/git rebase -q --no-verify commit_hash_1 commit_hash_2' exited with code 1 saying: /opt/git/git_current/libexec/git-core/git-sh-setup: line 46: /opt/tmp/git/libexec/git-core/git-sh-i18n: No such file or directory

Cause

Git couldn't find the file /opt/tmp/git/libexec/git-core/git-sh-i18n

Solution

Confirm if the file /opt/tmp/git/libexec/git-core/git-sh-i18n exists and is being used by the git that Bitbucket Server is using.

In this case, the file that git couldn't find is git-core/git-sh-i18n

  • As this is a core git file, this error might indicate that the git binary being used is incomplete and git should be reinstalled.
  • If the file is present, it can be pointed to using environment variables. Using Git Internals - Environment Variables as a guide, GIT_EXEC_PATH can be set for the Bitbucket Server user (atlbitbucket) so that it points to the correct git path.


Last modified on Jan 6, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.