Skip to content

Instantly share code, notes, and snippets.

@wcoder
Created January 13, 2019 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wcoder/2d6e919ed972bb77988d0715a5fbf1c9 to your computer and use it in GitHub Desktop.
Save wcoder/2d6e919ed972bb77988d0715a5fbf1c9 to your computer and use it in GitHub Desktop.
Simple script for mirror migrate a repository from Bitbucket to Github

How to use

  1. create repo on github (from web interface)
  2. run script:
./bitbucket_to_github.sh <user_name> <repository_name>

Sample:

./bitbucket_to_github.sh wcoder MySuperProject
#!/bin/bash
# clone from Bitbucket
git clone --mirror https://bitbucket.org/$1/$2.git
cd $2.git
# push to GitHub
git remote set-url --push origin git@github.com:$1/$2.git
git push --mirror
# clean up
rm -rf $2.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment