DEV Community

CristinaTRico
CristinaTRico

Posted on

Time to Git to it - Creating a repo from the command line

Coming from Flatiron there is a checklist of things I'm required to do each week during my job search. Although I've already been doing them I have not been tracking them until recently. One of the things being tracked is one of the basics I struggled with during my time at Flatiron: using Git and Github. Knowing that I will be required to make a minimum of 5 Git commits per week I've decided to review some Git basics.

Generally, I create a new repository on the GitHub site, but did you know you can actually do this from the terminal?
To begin, navigate to the directory you wish for this new repo to live. If you have access to the curl command which comes built-in with Mac, you can create a repository from scratch by making a call to the GitHub API.

Send a post request using the following:
curl -u "YourGitHubUsername" http://api.github.com/user/repos -d '{"name":"Name of Your Repository"}'

When you enter, you will be asked for your GitHub password.

Alt Text
You've just created a new repository from the command line!

Top comments (0)