Bamboo build fails with 'lfs' is not a git command
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
Summary
Problem
Bamboo build with a LFS enabled repository fails with git: 'lfs' is not a git command
.
Diagnosis
An error similar to the following is shown in the build error log or $BAMBOO_HOME/logs/atlassian-bamboo.log
1
2
3
4
com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.RepositoryException: : Cannot fetch branch 'refs/heads/master' from 'ssh://git@bitbucket:7999/proj/repository.git' to source directory '/var/bamboo-home/xml-data/build-dir/_git-repositories-cache/5400d01914c91908bd7f6e5e91880528ee4e82c3'. command /bin/git lfs logs last failed with code 1. Working directory was [/data/bamboo/xml-data/build-dir/_git-repositories-cache/5400d01914c91908bd7f6e5e91880528ee4e82c3]., stderr:
git: 'lfs' is not a git command. See 'git --help'.
Did you mean this?
log
Cause
Git LFS has been enabled for the repository, however Git LFS is not installed on both the Bamboo Server and / or agent responsible for the build. Or git-lfs is not in the path.
Solution
Resolution 1
On both the Bamboo Server and agent responsible for the build: download and install the git-lfs command line client
Initialise Git LFS:
1
$ git lfs install
Resolution 2
From the command line locate git-lfs
1
which git-lfs
Or if not in your terminal path. Note you will need to ignore any files with a path in /doc/:
1
find / -name git-lfs -executable -print 2> /dev/null
Add path from above to the Bamboo path:
Was this helpful?