Create a fork in a repository or merge branches yields git error code 128

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Symptoms

When forking a repository, a message similar to that is displayed:

1 An error occurred while executing an external process: '/usr/bin/git clone --bare --shared /home/bitbucket/data/data/repositories/8 /home/bitbucket/data/data/repositories/22' exited with code 128 saying: fatal: Could not get current working directory: No such file or directory

When merging a Pull Request, a message similar to that is displayed:

1 Caused by: com.atlassian.bitbucket.exception.ServerException: An error occurred while executing an external process: '/usr/bin/git clone --no-checkout --shared -b master /var/lib/bitbucket/data/repositories/156 /var/lib/bitbucket/tmp/git/jamf_standard_library-merge2972724898070904938.git' exited with code 128 saying: fatal: Could not change back to '/root': Permission denied

Cause

Bitbucket Server has been started from a path that it doesn't have access anymore or does not exist. You can find the PWD tag of the following part of the application.xml (after you generate the Support Zip):

1 2 <PWD>/root</PWD> <HOME>/home/bitbucket</HOME>

Resolution

Please start Bitbucket Server from its home directory.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.