Know what is up everybody this is Jason with slopestyle com and in this video we're going to learn how
to work with local and remote servers.
We're going to learn how to take our projects and push them up to get hubs so we can start tracking
this version control.
All right we've already learned how to track files.
Now it's important and it's time to get them pushed.
So what we're going to do is I want you to open up your browser.
And I want you to be in your hub account.
All right.
And what we're going to do is we're going to create a new repository.
So kind of on the home page of your account you can see here is a new repository here.
And on the dropdown There's also a new repository and you can find it in other places.
Now for this video it's the same repository.
I'm going to be using the word Ribault because it's a lot easier to say and it's a little bit more common
to say.
So go ahead and click on new repository.
All right.
So here we we are going to give our repository a name.
And in this case let's just call this my first Ribault.
OK all right.
And then we can give it a.
We won't worry about a description doesn't matter.
And then down here we can either create this Ribault to be public or private.
Now with good public Repos are free if you want to create private repo's if you're working with a business
or you're a freelancer and you keep the project private you can sign up for one of get hubs plans.
All right.
And then coming down here you can initialize a Rimi file which you should really always have for each
one of your projects giving in overview or a description of what it is and how it works.
And then at the very bottom here and you can see that you can add a good ignore file.
And this is really really cool.
So what I'm getting ignored does is it tells get to not track specific files so why would we want to
do this.
Well for example if we're working on a project and we're using a third party library of some sort.
Like firebase for example.
And you have a unique app ID that it generates for you.
You're going to want to keep that private.
You're not going to want to push that to a public repo Otherwise everybody can get into your account
it could really mess things up.
But if you're using this app ID from firebase for example in your project and it's referencing it for
local testing then you would probably want to do it ignore on a file like that so just so you know you
can ignore certain files in your project that you don't want to be tracked.
So we've gone ahead and we've given our people a name.
Let's go ahead and create it.
So I'm going to create a repository and then down here check this out.
So we've got a couple of ways that we can set this project up on our local machine here.
We can either do that through an h t t p s or S-sh and we're going to do this through S-sh since we've
already set up a key and it makes it a little bit more secure for us and because we didn't create a
Rimi file it actually is really cool.
It gives us the commands that we can throw in our terminal that we can do to set this up and you can
actually literally just copy and paste this let me open up my terminal here.
If we wanted to we could literally just copy and paste the get in it add the read me file make the first
commit and then add the repository so it can start tracking here.
And we're going to do this a different way.
It's going to be the more common way.
And now that we have this repository created we want to go ahead in what's called clone it to our local
machine here.
All right which is basically downloading it and copying it on our local machine here.
All right so we've got this all set up here.
So what I'm going to do is we're going to use our S-sh method of cloning this and this is going to work
for us because we've got ahead and we set up an S-sh key already.
So go ahead and hit copy to clipboard and then inside of our terminal here we're going to go ahead and
just navigate to your desktop and we're going to go ahead and throw the project on here.
So we're going to write in get clone and then go ahead and paste in the URL that get hub provided to
you and hit and hit enter.
And you can see it says it's cloning.
Into my first repo which is great and because we've set up our S-sh key go ahead and enter the password
for the perfect.
All right so let's go ahead and make sure this has cloned successfully.
And I've got it right here.
My first repot.
And if we open this up the folder is empty.
So coming back into our terminal Let's go ahead and create a few files here.
So I'm going to do first I need to get into my project.
So my first Ribault.
OK change the directory there and we'll create an HD mail file and a javascript file.
Cool.
So if we list that out we've got those two files there and then I'm going to poll where is my Finder
window it's hiding from me.
Here it is.
All right.
So we found it and we're on the desktop here.
And we just created this file here so I'm going to make this a little bit smaller.
We'll bring up the terminal up here.
Sorry for all the you one peanuts.
All right.
So we've created our first two files in here now.
Now we have created our repo.
We haven't pushed anything from it and we're also not tracking anything yet.
So if we do get status it says that we have some untracked files here so we can go ahead and use the
and dash AA because that's going to grab everything inside of this directory here and we're going to
go ahead and add it and then we'll do it here and we're going to type in the message will be added files
can and then if we do a get status again it says nothing to commit working tree is clean.
And if you notice this time around when we created this project on cloned it and we didn't have to do
it.
And the reason is because we we already set up this repository up and get HUD which also includes like
initializing it and saying hey we created this repo it needs to be tracked.
So that's why we didn't have to do it in our terminal.
All right so we've got a clean working tree here now.
A good rule of thumb something you're always going to want to do before you push your code up to your
repo here is you always want to make sure you do a poll first.
So the steps that we want to accomplish here is do a get and get commit good poll and then the name
of our branch.
All right so we can pull the most current code into it to make sure it's up to date and then we'll do
a push.
All right and we do polls because if you have multiple people working on a codebase other people might
be pushing to the repository like features that are completely finished and polished and that work.
And you want to make sure that you're polling in all of that code first before you push so you don't
have any like crazy merge conflicts in case you were working in the same file on the same line.
All right so what we're going to do first is do a good poll origin.
All right.
And then the name of our branch which if we check over here somewhere will say here but we're on the
master branch.
All right.
So Master and then go ahead and hit enter.
It's going to ask you for your key.
Go ahead and throw on your password and it says Can it find remote master.
Sorry about that.
I want to do a good push Orjan master all right and then we'll do our key here and there you have it.
All right it's almost finished there boom.
So it's created a new branch for us it's created master and we've got a repo here so if we come over
to our account and have a refresh on it you'll now see that we've got both of our files in here.
Everything is being tracked.
Everything is being pushed and everything is fantastic.
All right.
Now there's one more thing that I want to show you with these poll requests.
So I mentioned earlier that there might be other developers working on the same project and they might
push some changes up to this mass or branch for an example.
So why don't we do this.
Why don't we come into our get have and we didn't create a Rigney file before.
But let's go ahead and add one now.
So I'm going to hit add and then it has my first repo here and then let's make a change to this file
and same.
Everything is so great in life and I love to skate.
I don't know just something crazy here.
All right.
And then we can go down to the bottom and do commit new file.
All right so now what we've done is we've just committed a new change from our repository and get it
right.
But what about our local.
We made this change on the remote server what about our local branch here.
So check this out.
If I was to do a guest status I obviously have a clean working tree right.
Well check this out.
If we list out the items here I don't have a read any file in here but if I was to do a good poll Orjan
master and hit enter.
We're now going to enter our password.
I think I typed it wrong right.
Boom.
Check this out.
We have now pulled in one file change with three insertions.
So it took in the Rigney file and it now has stored that read me file here on my local repository.
So it's very important to keep your local branch up to date with the remote and we can do this by Remember
following these specific steps.
Get ad get commit get Paul and then do your get push.
So that is a wrap for this video.
Let's move on.