

I was able to overcome this by switching to the HTTP endpoint and re-pushing.

Note if you receive a “exit status 255 connection closed by remote host” error when attempting to do the git lfs push, this seems to be an issue with using the SSH endpoint for connecting to the Bitbucket repo. To ensure the tags get migrated as well execute the following command:ĩ.) (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.ĭo this by executing the following command: The git push doesn’t push all the tags you might have on your current repository. You can do that through this command:Ħ.) Now you are ready to push the repo up to the new Bitbucket address.įirst, we need to change the remote reference in our local Git repo to the new Bitbucket endpoint:ħ.) After this, we do a git push to push all branches up to the remote on Bitbucket:Ĩ.) We’re not done.

To do this is a simple shell script that will checkout each branch of the repo to your local machine.įor 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. The stepsġ.) 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:ģ.) Update your local repo with the metadata (branch names, tags, etc.) from the GitHub remote by running:Ĥ.) 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. Overall it’s a pretty straight forward process, however there are enough tiny little gotchas that I thought it would be worth documenting the steps in a blog post. (Yes, I know there is an import wizard that can do this, however this is for the OG’s out there that trust nuthin’ but their own Terminal window). At Blue Label Labs, we’ve recently migrated from using GitHub as the hosting for our source code repositories to Bitbucket.Īs a leading app development agency, this has meant we’ve had to go through a lot of repositories and perform a manual migration of repositories we previously held in GitHub into our corporate Bitbucket account via the CLI.
