Last active
December 17, 2015 10:58
-
-
Save tgvashworth/5598252 to your computer and use it in GitHub Desktop.
Github to Bitbucket
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 | |
# 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 |
Stu, can you do this:
echo $PATH
In your command line and post back what it outputs?
/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
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.
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
ok, I've managed to save this file as github-to-bitbucket.sh into my usr/local/bin
I ran - chmod u+x github-to-bitbucket get no such file. Tried chmod u+x github-to-bitbucket.sh didn't 'do' anything.
Closed terminal, re-opened and typed github-to-bitbucke and got command not found