Last active
August 29, 2015 13:55
-
-
Save islomar/8755364 to your computer and use it in GitHub Desktop.
Using Github's API to create repositories from the command-line
This file contains 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
http://robinwinslow.co.uk/2013/06/07/create-github-repositories-from-the-command-line/ | |
# replace USER and REPO with real values | |
# but *not* the "/user/" in the GitHub URL | |
$ curl -u 'USER' https://api.github.com/user/repos -d '{"name":"REPO"}' | |
# you will be prompted for your password | |
$ git remote add origin git@GitHub.com:USER/REPO.git | |
Create alias in git: | |
git config --global alias.gh-create '!sh -c "curl -u \"islomar\" https://api.github.com/user/repos -d \"{\\\"name\\\":\\\"$1\\\"}\" && git remote add origin git@github.com:islomar/$1.git" -' | |
Use alias: | |
$ git gh-create canvas-play # create the GitHub repository | |
$ git push -u origin master # push my repository to GitHub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment