January 10, 2015 - No Comments!

How to create a github repo from the command line

The awesome thing about the command line is the intimate relationship you build up with the internet (as opposed to the world wide web). Not to mention the time saving... Why open a browser, navigate to github, click here and there to create a repo, when it can be done in one line from the prompt?

 

Here's how:
curl -u "yourgithub@email.com" https://api.github.com/user/repos -d '{"name":"yourdesiredreponame"}'

What is going on here? We are basically injecting data directly into Githubs database, via their API.

We are using curl (a tool to transfer data from or to a server) to call the Github API which we pass our username -u "email" and we specify that we pushing data with the -d '{"name":"var"}' flag.

Inside the data object we push to Githubs database we can specify more items than just the name, such as if a repo is private or not.

FYI here is the github API documentation

UPDATE: It's also possible to simply use the awesomeness of Hub - a command-line interface for GIT

Published by: admin in Snippets

Leave a Reply