Manually migrate LFS objects between two Bitbucket DC instances

Platform Notice: Data Center Only - This article only applies to Atlassian apps 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

Sometimes we want to use the migration tool to export repositories from a Bitbucket instance to another. If that’s the case, one of the tool’s limitations is that it doesn’t migrate LFS objects, which needs to be performed manually. Here we describe the steps needed to migrate these objects using git and git lfs.

Solution

We need to perform a mirror clone from Source Bitbucket instance. This would be the needed set of steps:

  1. Create a new empty repository on the Destination Bitbucket instance.

  2. Make sure that, under repository settings, LFS is enabled.

  3. On a local machine, create a new working folder: mkdir lfs-migration

  4. Enter the folder and clone the repository from the Source Bitbucket instance:  

    git clone --mirror <source-repository-url>

  5. Enter the created directory: cd <repository-name>

  6. Make sure that Git LFS is setup in the cloned repository:  

    git lfs install --local

  7. Pull all the LFS objects from the Source Bitbucket instance (this is probably going to take a while):  

    git lfs fetch --all

  8. Change the LFS URL to the Destination Bitbucket instance:  

    git config lfs.url <destination-bitbucket-url>/<project-name>/<empty-repository-name>.git/info/lfs

  9. Set the new remote URL:  

    git remote set-url origin <destination-bitbucket-url>/<project-name>/<empty-repository-name>.git

  10. Push all the regular Git objects to the new origin:  

    git push --all origin

  11. Push all the LFS objects (this is also going to take a while):  

    git lfs push --all <destination-bitbucket-url>/<project-name>/<empty-repository-name>.git

This should migrate all the objects to the Destination Bitbucket. After the process is finished, please create a new folder and try cloning the new repository and see if the LFS objects are downloaded successfully.  

Updated on September 25, 2025

Still need help?

The Atlassian Community is here for you.