Initializing a new git repo with Github's hub CLI

Chris Biscardi
InstructorChris Biscardi
Share this video with your friends

Social Share Links

Send Tweet

hub is a command-line tool that makes git easier to use with GitHub. In this lesson we cover a couple of the commands in a real-world scenario at the start of a project.

Chris Biscardi: [0:00] In our terminal on the left we're in an empty directory. Since we're using GitHub to host our git repos, we're going to use hub, which is a command line tool for interacting with GitHub to create our new repository.

[0:13] First, we'll initialize a new git repo. Then, we'll create a new README.md file. If we look at our README file, we'll see it says Serverless TODOs. We can now add the README file to our git repo and commit it.

[0:34] If we look at our git history, we can see that we've committed a README file, but we haven't created the repository on GitHub yet. That's where hub comes in. If I use which git to tell me what my git minor is pointing to, we can see that it's aliased to hub.

[0:47] Hub is the command line tool that we talked about earlier. We can use hub create to create a new GitHub repository. It spits out a link for us. If we click it, we can see that we have our new GitHub repository. If we push in refresh, we can see that we have the README file in our new GitHub repository.