Presenter: In this video, I wanna 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 wanna use GitHub
and you know you need a git-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 gonna 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 chicken's?
Chickens-demo.
Okay, and we can make it public or private.
We will come back at a later point
in the course to talk about README files.
We've already talked about get Ignore.
So if, if you wanna start with a gitignore file,
we can do that on GitHub and clone that down.
Or we can make our own gitignore.
I'm just gonna 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 gonna copy that
and then I'm gonna 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 git status.
We're not in a git-repo.
I'm now gonna run git clone, and then chickens-demo.git
and it tells me you appear to have cloned
an empty repository.
Okay, so we have a new folder called chickens-demo.
There's nothing in there, but it is a new folder.
And if I type git 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 a really simple file.
touch chickens.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 chicken, Stevie Chicks in there
and then The Grey Lady / Lady Gray, another one
of my chickens.
Anyway, we have some contents in there.
I'm gonna add and commit.
Pretend we've done some actual work.
So get add chickens, git commit, add,
You know, my first two chickens, great fire, fresh 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 wanna get those on GitHub.
So I'm not gonna 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 gonna 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 in Maine
but I just have the master branch.
So git push origin master, just one simple commits.
If I refresh, we see chickens.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.
Okay