It appears Bitbucket's import tool does not import LFS objects.
-
First, create new a repo on Bitbucket and take note of the URL (or SSH endpoint) of the new repo.
-
In a terminal window, clone the existing project from GitHub:
git clone <URL> -
Update your local repo with the metadata (branch names, tags, etc.) from the GitHub remote by running:
git fetch --all -
Prior to migrating the repo to Bitbucket, we need to make sure that locally on this machine we have checked out all remote branches and have them in our local repo. To do this is a simple shell script that will checkout each branch of the repo to your local machine.
for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done -
(Optional) If you are using Git LFS for large files, then you need to also fetch and pull down any LFS files hosted on your repo. You can do that through this command:
git lfs fetch origin --all -
Now you are ready to push the repo up to the new Bitbucket address. First, we need to change the remote reference in our local Git repo to the new Bitbucket endpoint:
git remote set-url origin <BitBucket repo address> -
After this, we do a git push to push all branches up to the remote on Bitbucket:
git push --all -
We're not done. The git push doesn't push all the tags you might have on your current repository. To ensure the tags get migrated as well execute the following command:
git push --tags -
(Optional) Finally, if you are using Git LFS, we need to push all the LFS files we downloaded in step 5 to the new repo. Do this by executing the following command:
git lfs push origin --all