- [Instructor] Hi, I'm Cameron MacKenzie.
I'm the Editor in Chief over at TheServerSide.com.
You can follow me on Twitter @cameronmcnz
and I wanted to talk to you a little bit
about how you can take your local commits
and push those commits to origin using Git and GitLab.
So right now my GitHub repository is pretty boring.
All I've got is a read me file right here.
Now in a previous tutorial I actually went in here
and I cloned that repository by doing a Git clone command.
You can see it right there.
I'm going to cd into that
and you can see, yeah, I've only got one file in here.
So why not make this a little bit more interesting?
So I'm going to do a little touch
and create a file called home.html,
do a little touch and create a file called style.css
and do a little touch and create a file called I don't know,
script.js, does that make sense?
And so if I do a little ls file
I've got one, two, three, four files in here.
How many are new, well Git status will tell you that?
So it says ,hey, you've got a three brand new files
in this folder and none of them have been,
will be committed because none of them are tracked.
And how do you track them?
It should get add command.
And then if you say, Git status, it says, you know what?
These files are now being tracked
because you have added them to the index of tracked files.
So I've created some files
I've added them to the Git index and they are now staged.
And I guess the next thing to do is push them
push these up to the, the GitLab repository.
Cause I've got these locally, you know
but if I do a refresh over here, there's no new commits
and there's only one read me file on the GitLab server.
So ,let's go back in here and what do I need to do?
Well ,I guess what I need to do is I need
to actually just do a commit.
(keyboard clicking)
And then I do a push.
Now the problem is this commit won't work.
And the reason this commit won't work is
because I just installed Git and after you installed Git,
you actually have to configure your username and email.
So,(keyboard clicking)
So there's me just configuring my email
(keyboard clicking)
Me configuring my name.
And now if I want to do that commit command,
ah, there's no problem everything has been committed
but still those files are not up on GitLab,
not there at all.
So what's the next step?
Well, the next step is to Git is a Git push.
So I say, Git push origin.
This is going to take all of the changes
and my whole commit history that exists locally
and then push them to the original repository that I clone.
That's the idea behind origin?
Now when I do this I do this.
It's gonna ask for my username and password.
The username right now is root
and the password is quite unceremoniously password.
All of a sudden those files get pushed.
And if I do a refresh over here,
you can see that we now have a new commit
called add three files.
You are supposed to do an active sort of commit messages.
So when someone looks at it
and they said, this particular commit will add three files
it should kind of read like that.
And there's my home file.
There's my script file.
There's nothing, there's nothing in them,
but you can see that these files have been added.
There has been a new commit
and all of this content has been pushed
to the remote, GitLab server.
And that's how easy it is to create content and do commits
and push your local changes to
your remote, remote, GitLab repository.
Now to learn more about GitLab, Git and all things
that happen over on TheServerSide,
head over to TheServerSide.com.
And please follow me on Twitter cameronmcnz.