Created
July 27, 2019 06:19
-
-
Save jordancrawfordnz/87a2d9a3b6a6114e8b9b1a46e0fee3d2 to your computer and use it in GitHub Desktop.
Moving Git Repos from BitBucket to GitHub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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