Skip to content

Instantly share code, notes, and snippets.

@kenchangh
Last active August 29, 2015 14:02
Show Gist options
  • Save kenchangh/ebd6144f6aa238e54566 to your computer and use it in GitHub Desktop.
Save kenchangh/ebd6144f6aa238e54566 to your computer and use it in GitHub Desktop.
github-create.sh
github-create() {
echo "Enter your new GitHub repository's name: "
read repo_name
echo 'Sending requests to GitHub to create repository...'
curl -u 'guanhao97:9f733ad9a8cca515a8c8ad3a67a6f1a9c6ec488b' https://api.github.com/user/repos -d '{"name":"'$repo_name'"}'
cd /home/guanhao97/Desktop/$repo_name
echo 'New local repository? (y/n)'
read new_local
if [ $new_local == 'y' ]
then
echo 'Initializing new repository...'
git init
else [ $new_local == 'n' ]
echo 'Okay, moving on...'
fi
git add --all :/
echo 'Enter your commit message: '
read message
git commit -m "$message"
git remote add origin git@github.com:guanhao97/$repo_name.git
echo 'Pushing to GitHub...'
git push -u origin master
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment