Check out a free preview of the full Introduction to the JAMStack course

The "Deploy a GitHub Repo" Lesson is part of the full, Introduction to the JAMStack course featured in this preview video. Here's what you'd learn in this lesson:

Jason demonstrates how to deploy a repository to GitHub, and how to use the hub tool. Hub makes deployment more seemless.

Preview
Close

Transcript from the "Deploy a GitHub Repo" Lesson

[00:00:00]
>> To deploy this, what I'm actually gonna do is just create another repo inside of here. This is not particularly good Git hygiene, but we're all learning together, right? So let me let me push what I've done first. So that's now up on the fem-progress branch, if you wanna check out where we are now.

[00:00:21]
And then I'm in the sections/basic, and I'm just gonna run, git init. And what I'm doing with git init, here, is I'm setting up a new repo. So if I look at my git status, it's gonna show us these three files as untracked. And that's because I've just kind of set up a whole new Git repo in here.

[00:00:50]
So what I wanna do is I wanna create a new repo. And I'm gonna take a quick detour here to show you one of my favorite tools that I found in a long time. It's called hub. And what hub does is it gives you a whole bunch of amazing CLI benefits.

[00:01:10]
So feel free to install this or not, this is completely optional. But if you work in GitHub often, this is a tool that legitimately has improved my life. And so what it does is it gives us a set of tools that we can create new repos. We can open the GitHub repository right from the command line.

[00:01:32]
We can create pull requests, and approve pull requests, and check out pull requests. All these things that take a lot of time, if you do them through the UI, you can do it all from the command line. And so that's gonna help us as we move through a lot of today.

[00:01:46]
And it'll help anyone who works on a Git-based workflow. It should help you quite a bit. And so what I've done is I've actually gone in and created an alias for it in my dot files. So I ran the brew install hub to get it. And then if I open up, Where is it?

[00:02:08]
The my bash_profile. Boy, I'm really bad at this aren't I? There it is. So I have a lot of aliases to help me out. This is that git status one. But the one that I'm specifically talking about here is I've aliased git to hub. So hub does all the things that git does regularly, but then it just adds that extra layer of utility on top of it.

[00:02:29]
So when I'm using git, I don't notice that I'm using hub. But then when I need those extra tools, this really helps. So what I can do now that I have this, is I can just say, git create, and I'm gonna call this jamstack-intro-basic. And so it's now created a repo for me.

[00:02:55]
So, with that repo, I can git add everything. We'll check it, good. Let's git commit that and say, my first JAMstack site. And then I'm going to push that to master. If you didn't want to install hub, you can go to github.com. Let me open this in a browser where I'm logged in.

[00:03:29]
Make that smaller, okay. So if you don't wanna install hub, you can go to GitHub, and up here at the top, you can hit New repository. And you can call it whatever you want. Well, you could say, It can be Public or Private. I mean, I recommend going public by default unless you've got a really good reason.

[00:03:53]
And then I'm gonna leave everything else empty, create my repository. And then, Would follow these instructions here. So we initialized the repo already. We would add our files, and then you just follow these steps, git remote add. And you set up your origin and point it to this new repo that you've created.

[00:04:16]
And then you can git push origin master to get the files up.
>> You did the git init in the basic folder or in the root?
>> Well, so I want the basic folder to be the root of this particular example. So, yeah, you run git init in whatever what you want the root of your site to be.

[00:04:35]
So if I go back over here, and I can say, git browse, and this is a hub tool, it will open up this repo that we just created.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now