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
Published 4 years ago
Updated 3 years ago

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.

egghead
egghead
~ 7 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today