When Bitbucket Server/Data Center performs merges, it does so using temporary work trees created in %BITBUCKET_HOME%\tmp\git. After the merge completes (successfully or not), the system deletes the work tree. However, when Bitbucket Server/Data Center is running on Windows, Git for Windows creates certain files as read-only and the system does not clear that flag. As a result, cleanup silently fails and temporary files can accumulate over time. For workflows that produce a lot of cross-repository merges (merges where the source and target branches are in different repositories), it's much more likely that temporary files will be leaked.
This issue does not affect Linux hosts. It is specific to Windows.
- Create a pull request between two branches in different repositories
- Merge the pull request
Work tree files in %BITBUCKET_HOME%\tmp\git are cleaned up when the merge completes.
Some number of files are left in place, leading to a steady accumulation of files/directories over time.
When restarting or upgrading Bitbucket Server/Data Center, manually delete the entire %BITBUCKET_HOME%\tmp directory. It will automatically be recreated the next time the system starts. This will purge the accumulated files.