Skip to content

Instantly share code, notes, and snippets.

@tgvashworth
Last active December 17, 2015 10:58
Show Gist options
  • Save tgvashworth/5598252 to your computer and use it in GitHub Desktop.
Save tgvashworth/5598252 to your computer and use it in GitHub Desktop.
Github to Bitbucket
#!/bin/sh
# Github -> Bitbucket
# - Save this in /usr/local/bin as github-to-bitbucket
# - Then:
# cd /usr/local/bin
# chmod u+x github-to-bitbucket
# - Then restart your terminal
# - You should now have a github-to-bitbucket command
# Or run:
# cd /usr/local/bin && wget -O github-to-bitbucket https://gist.github.com/phuu/5598252/raw/gistfile1.sh && chmod u+x github-to-bitbucket
# then restart yaw terminals.
# Reconnaissance
echo
echo " GitHub -> Bitbucket"
echo
read -p " Project name : " -r PROJECT_NAME
read -p " GitHub .git url : " -r GITHUB_URL
read -p " Butbucket .git url : " -r BITBUCKET_URL
# Make sure all is well
echo
echo " Cool."
echo
echo " I'm gonna clone $GITHUB_URL from Github into $PROJECT_NAME,"
echo " then push it back up to $BITBUCKET_URL on Bitbucket."
read -p " Still cool? [y/N] : " -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo
echo " Here we go..."
echo
git clone $GITHUB_URL $PROJECT_NAME &&
cd $PROJECT_NAME &&
git remote add bitbucket $BITBUCKET_URL &&
git push bitbucket master
fi
@sturobson
Copy link

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin is what's returned, I'm sure this means I'm doing something wrong

@jackfranklin
Copy link

No that looks fine. /usr/local/bin is in your $PATH. The file should be saved without .sh though.

cd /usr/local/bin
sudo chmod u+x github-to-bitbucket

Should do it.

@sturobson
Copy link

that damned osx had added .txt to the file and hidden the extension on me. All working now, you guys rock :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment