Git LFS now available in Bitbucket Pipelines

By on March 20, 2018

Bitbucket Pipelines now has built-in Git LFS support, allowing you to seamlessly build, test and deploy LFS files in your builds!

To enable it, just add lfs: true in the clone section of your bitbucket-pipelines.yml. If you don’t enable this feature, your clone will continue to behave as before.


clone:
  lfs: true
 
pipelines:
  default:
    # ... rest of Pipelines configuration ...

How does it work?

Behind the scenes, Pipelines now always uses an LFS-enabled Git client when it clones your repository, allowing LFS files to be downloaded as part of your Pipelines build. However, we’ve decided to maintain the existing behavior of not cloning LFS files by default, which can be slow to download and not needed for many types of builds. So in the case where LFS is not specifically enabled, Pipelines passes a parameter to the clone command to prevent it pulling LFS files.

The LFS clone configuration applies to all pipelines and steps in your build configuration. If you want to pull LFS files only in specific pipelines or steps, you’ll need to use the same workaround as before: include an appropriate Git client in your build image, and pull with SSH authentication to retrieve the files.

When you try it out, you might be wondering why you don’t see git lfs commands in the Build setup of Pipelines. While researching this feature, we found that git clone is now as performant as the deprecated git lfs clone. This wrapper command previously performed a standard clone and git lfs pull but is no longer recommended.

This should be a great improvement for all our Git LFS and Pipelines users. Please let us know what you think!