In this video, I want to show you option two for getting your code up on GitHub or connecting a local
repo to a hosted repo.
Starting from scratch.
So this works if you haven't started your work on your project at all.
You know you want to use GitHub and you know you need to get repo on your machine, but you don't have
an existing project to push up.
So we can start on GitHub, we can make a brand new empty repo on GitHub.
So that's what I'm going to do.
Then we clone that to our machine.
So I'd make it on GitHub, clone it down, and that act of cloning it down automatically configures
the remote for me, so then I can do some work and push it up.
So this will be quick.
Let's make a new repo.
Remember, you can do that by clicking new or by going to the plus sign new repository.
I'll make this one.
I don't know.
How about chickens?
Chickens, demo ock?
And we can make it public or private.
We will come back at a later point in the course to talk about Read Me files.
We've already talked about getting more.
So if you want to start with a get ignored file, we can do that on GitHub and clone that down or we
can make our own git ignore.
I'm just going to keep this simple and have an empty starter repository called Chickens Demo.
All right.
So now that I have this empty repository on GitHub, the next step is to clone it down to my machine.
Right.
So we've made this repo on GitHub.
There's no corresponding repo on our machine.
We clone it down.
So to clone, all we need to do is copy this URL, right?
So I'm going to copy that and then I'm going to go to my local machine.
Let's back out into let's see, just the GitHub directory I made.
I have this cloning directory.
Sure.
So in here type get status, we're not in a git repo.
I'm now going to run git clone and then chickens demo git.
And it tells me you appear to have cloned an empty repository.
So we have a new folder called Chickens Demo.
There's nothing in there, but it is a new folder.
And if I type get status, it is a git repository and I don't have any work to push up.
But we do have a pre configured remote called origin.
So now I can do some work.
Let's make a really simple file.
Touch chickens dot txt and then we can open that up and put something in there.
So here it is in my editor.
Let's put one of my chickens, TV chicks in there.
And then the Gray Lady slash Lady Gray.
Another one of my chickens.
Anyway, we have some contents in there.
I'm going to add and commit.
Pretend we've done some actual work.
So get add chickens, get commit.
Add my first two chickens.
Great.
If I refresh GitHub, nothing has changed whatsoever because I still have to push as we've talked about.
So that's the next step.
I've done some work, not a whole lot, but I've done some work locally.
Now we push that up.
So it's the same exact workflow from this point forward.
The only difference between what I showed you earlier is that we cloned an empty repo and started working
in that repo versus our first approach was we've been working on something locally.
We have a bunch of commits.
I want to get those on GitHub.
So I'm not going to clone an empty repo.
I already have my repo on my machine, so I make an empty repo on GitHub and then I configure a remote.
So my local repo points to that GitHub repo.
Anyway, I'm going to push.
So it's just the master branch at this point, right?
That's the only branch I have.
In the next video I'll talk about Master and Main, but I just have the master branch.
So get push origin master.
Just one simple commit.
If I refresh we see chicken.
TXT is here and we have our one commit.
Just one add my first two chickens.
That's all the history we have on this branch.
So that's just another way of connecting a local repo to a GitHub repo.
Different approach, but then the same workflow.
Once we have that connection established, do some work, add commit and then use push.