In this post I’ll show how Git repo can be completely transferred from BitBucket to Visual Studio Team Services.
However, this instruction will be relevant for Git repo transfer between any origins, such as GitHub, Stash, GitLab, etc.
Before migration starts, it’s important to commit and push all changes from local repositories to the current origin (which happens to be BitBucket in our example).
First of all you have to have SSH access to both source and target repos, check that you have relevant keys and config:
Clone source repo and make local copy of all branches:
Create target Git repo (VSTS in this example):
Add new origin to the local repo, push everything to the new origin, remove source origin and rename new origin:
git remote add vsts-origin ssh://firstname.lastname@example.org:22/test1/_git/powershell
git push --all vsts-origin
git push --tags vsts-origin
git remote rm origin
git remote rename vsts-origin origin
Check that in VSTS all branches and commits are available:
Also you can see that tags pushing can be a problem if you use ’em:
Now it’s time to add permissions for developers, and they can use the same ssh keys.
However, they have to delete their current local repos and clone ’em again from new origin.
It’s good idea to keep old origin (BitBucket in our example) for a while, but remove all permissions except owner (root, admin or whatever other service account).
I hope this info will be useful for you, and if you need any help feel free to use contact from on the main page.