Guide to Migrating Repositories Containing LFS from Bitbucket Server/Data Center to Bitbucket Cloud
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
This document provides step-by-step instructions for migrating large repositories from a server to the cloud using Bitbucket. The process involves using the migration assistant tool, handling Git LFS objects, and executing mirror clones to ensure a seamless and successful migration.
Solution
Step 1: Install the Migration Assistant Tool (BCMA) and select the repository (or repositories) with LFS files for migration to Bitbucket Cloud. BCMA will handle the repository source, branches, tags, pull requests, and users but will not migrate the LFS files. To migrate the LFS files separately, follow the next steps.
Step 2: After the repository migration, perform a mirror clone of the migrated repository from Bitbucket Server, for example:
git clone --mirror ssh://git@bitbucket.mycompany.com:7999/upstream/PROJ/re
Step 3: Install Git LFS Locally
git lfs install --local
Step 5: Fetch all the LFS objects using the command:
git lfs fetch --all
Step 6: Check the LFS environment with:
git lfs env
Configure the LFS URL to point to the Bitbucket Cloud repository:
git config lfs.url https://bitbucket.org/your_workspace/your_repo.git/info/lfs
Step 7: Set the remote URL of the origin to the Bitbucket Cloud repository using the following command (replace the URL with the correct one):
git remote set-url origin https://bitbucket.org/your_workspace/your_repo.git
Step 8: Push all the LFS objects to the Bitbucket Cloud repository:
git lfs push --all https://bitbucket.org/your_workspace/your_repo.git
We have outlined the complete process to migrate large repositories from a server to the cloud, ensuring a seamless transition while managing large files using Git LFS. If you encounter any issues during the migration, feel free to seek assistance from the Bitbucket support team.