Skip to content

Instantly share code, notes, and snippets.

@ianchesal
Created July 17, 2020 21:38
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 ianchesal/1a4202d4dad6a82398b953dd4afbaa4a to your computer and use it in GitHub Desktop.
Save ianchesal/1a4202d4dad6a82398b953dd4afbaa4a to your computer and use it in GitHub Desktop.
Convert a bitbucket repository to a github repository
#!/bin/sh
# Usage:
#
# cd ~/src/some-bitbucket-repo
# ~/bin/bitbucket2github.sh
#
# The script assumes the name of the directory is the name
# of the repository that you want to use on github.com.
USERNAME=ianchesal # CONFIGURE THIS!!!
REPO=${PWD##*/}
set -ex
while true; do
read -p "Migrate repository ${REPO} to Github? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no. ";;
esac
done
git remote rename origin bitbucket
git remote add origin git@github.com:${USERNAME}/${REPO}.git
git push origin master
git remote rm bitbucket
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment