Created
April 16, 2020 11:03
-
-
Save jmserra/428b11832a7b43b02f8c5616e77861f1 to your computer and use it in GitHub Desktop.
migrates one repo with all its branches and tags from bitbucket to github
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
if [ "$1" = "" ] | |
then | |
echo "Usage: $0 REPO" | |
exit | |
fi | |
BBORG=my-bitbucket-org | |
GHORG=my-github-org | |
REPO=$1 | |
echo "Migrating $BBORG/$REPO -> $GHORG/$REPO ..." | |
gh repo create $GHORG/$REPO > /dev/null | |
git clone --mirror [email protected]:$BBORG/$REPO.git | |
cd $REPO.git | |
git remote add new [email protected]:$GHORG/$REPO.git | |
git push --mirror new | |
cd .. | |
rm -Rf $REPO.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment