Created
July 17, 2020 21:38
-
-
Save ianchesal/1a4202d4dad6a82398b953dd4afbaa4a to your computer and use it in GitHub Desktop.
Convert a bitbucket repository to a github repository
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
#!/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 [email protected]:${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