Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Moving Git Repos from BitBucket to GitHub
OLD_REPO_NAME=[fill this in]
NEW_REPO_NAME=[fill this in]
USERNAME=[fill this in]
# Create the new repo in GitHub first.
# For all repos. This does a mirror clone so all references, tags, etc are migrated.
git clone --mirror git@bitbucket.org:$USERNAME/$OLD_REPO_NAME.git
cd $OLD_REPO_NAME.git
git push --mirror git@github.com:$USERNAME/$NEW_REPO_NAME.git
cd ..
rm -rf $OLD_REPO_NAME.git
# Include this for cloned repos only. This will update local references so you don't have to later.
git remote remove origin
git remote add origin git@github.com:$USERNAME/$NEW_REPO_NAME.git
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.