Skip to content

Instantly share code, notes, and snippets.

@jmserra
Created April 16, 2020 11:03
Show Gist options
  • Save jmserra/428b11832a7b43b02f8c5616e77861f1 to your computer and use it in GitHub Desktop.
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
#!/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 git@bitbucket.org:$BBORG/$REPO.git
cd $REPO.git
git remote add new git@github.com:$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