Unable to push annotated tags to Bitbucket server where LFS (Large File System) File lock is enabled.
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
When there are multiple files locked by the users in an LFS-enabled repository and someone tries to push a tag into it, it times out. There are no other errors in the logs. But you will still be able to create the tag from the Bitbucket UI.
Environment
Bitbucket server <6.10.11, 7.6.6, 7.12.1
Diagnosis
When the push command is being executed, it doesn't return any other error. It just times out like below after hours.
git push origin tagname
"/usr/bin/git -c core. hooksPath-hooks receive-pack <bitbucket_home>/shared/data/repositories/1" timed out on server.
If we run the same command with debug mode, like below, it runs in an infinite loop for more than 24 hours and fetches the locks.
GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 git push --tags
git lfs locks
command lists more than 100+ locks on files of the repository.
Cause
The git lfs locks --verify
command that runs as part of the git push
, runs infinitely when there are more than 100 LFS files with locks in the repository. There is already a bug raised for this.
So because of this, the push command never completes.
Solution
As a workaround, you can push the tags with the --no-verify parameter. This skips the lock verification.
git push --tags --no-verify
The permanent fix for this problem would be to upgrade to a fixed version listed in the bug report, which are 7.6.6, 6.10.11 and 7.12.1.