Bamboo fails to check revisions out from Bitbucket Server
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
Bamboo fails to checkout code from Bitbucket server with the below error when the repositories are LFS enabled.
fetch: Fetching reference 4ee0d77f3d56999d704c0684bce92c4495d412e0
batch request: unexpected end of JSON input
...
error: failed to fetch some objects from 'https://127.0.0.1/PRJ/repo.git/info/lfs'
Environment
Bitbucket Server 7.0.x +, Git LFS version 3.0.x in both Bamboo server and Bitbucket Server.
Diagnosis
You could see the below errors in the bamboo logs while the code is being checked out.
com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.RepositoryException: Cannot fetch branch 'refs/heads/*' from 'ssh://git@bitbucket-prod:7999/PRJ/repo.git' to source directory '/var/atlassian/bamboo/xml-data/build-dir/_git-repositories-cache/3124058f668e0bf905bdfa1e7e7d956d06543712'. command [/usr/bin/git lfs fetch ssh://0fed2d8c-6e76-4000-b64e-4c914168ea4f@127.0.0.1:7999/PRJ/repo.git 4ee0d77f3d56999d704c0684bce92c4495d412e0] failed with code 2. Working directory was [/var/atlassian/bamboo/xml-data/build-dir/_git-repositories-cache/3124058f668e0bf905bdfa1e7e7d956d06543712]., stderr:
fetch: Fetching reference 4ee0d77f3d56999d704c0684bce92c4495d412e0
batch request: unexpected end of JSON input
batch request: unexpected end of JSON input
batch request: unexpected end of JSON input
...
error: failed to fetch some objects from 'https://127.0.0.1/PRJ/repo.git/info/lfs'
Cause
The Git LFS version installed (3.0.x) on the Bamboo server seem to not be compatible with Bamboo and thus fails to checkout the code.
Solution
Downgrade the Git LFS installed on Bamboo Server to a lower version such as 2.13.x. This will be resolving the issue.