-
In this lesson we're going to
be creating a GitHub account.
-
We'll follow that up by creating
a repository.
-
We’ll then add to our local environment
the command line interface for Git.
-
We’ll generate some keys, and we’ll use
those keys to add them back
-
into the online GitHub account
-
in order for us to get access
from our local environment.
-
We’ll then clone the repository we
created to our local machine.
-
We’ll add a file, and ultimately, to
close it all off,
-
we will commit push those changes back
into the GitHub repository.
-
So we're going to go full cycle.
-
So let's go ahead and get started.
-
We'll go ahead and navigate to
github.com.
-
I'm going to go ahead and choose
a username here.
-
I'll go with abeluserman.
-
I'll set an email of
abel_user@hotmail.com.
-
And I’ll select a secret password.
-
Let's go ahead and click now on Sign up.
-
We’ll go ahead and go with the
free plan.
-
We can go ahead and skip this screen.
-
And as you can see there,
you can go ahead and start a project.
-
Let's go ahead and click on that.
-
And it's asking me to verify my email
address.
-
When you go to your account,
if you can't find it,
-
look for it under junk email,
like in my case.
-
I'm going to go ahead and
verify that email address.
-
And as you can see there, we’re back
in GitHub.
-
So it is asking me here for a
repository name.
-
I'll go ahead and call it “kali”.
-
I'll enter a description here,
-
just call it “Dummy Repo”.
-
I'll go ahead and leave it as public.
-
I will initialize it with a
README,
-
that way we can go ahead and
clone at as soon as we're done.
-
I'll go ahead and add a .gitignore file.
-
For our case, since we’ll be mostly
writing JavaScript files,
-
I'll go ahead and use the Node gitignore.
-
This is simply done to ignore files that
would not be copied over
-
by your entire team,
-
to simply ignore some of the files that
fit that pattern within Node.
-
Then, I’m then going to
add a license.
-
If you're not familiar with open source
licenses,
-
the MIT License is the most permissive.
-
That means there are no restrictions,
commercial or otherwise.
-
So I'm going to go ahead and create
it now.
-
And as you can see there, we
have a repository.
-
So we're ready to go when it comes
to having something
-
on GitHub that we can clone to our local
environment.
-
Now the next step is we're going to
set up our local environment
-
that is within the machine.
-
To do that, we're going to go
ahead and navigate to
-
git-scm.com/downloads.
-
As you can see there, it's one of the ones
that the pull down suggestions is showing.
-
And from here, we're simply going to
select the Windows version.
-
As you can see there, that content, or
that installer, is already downloading.
-
There we go.
-
The file has downloaded.
-
Let's go ahead and execute it.
-
I'm gonna go ahead and select
“Additional icons” in this case.
-
I'm going to go ahead and
go with the default.
-
Now let's go ahead and launch
the Git Bash.
-
Let's go ahead and
make that window bigger.
-
OK, now we have a nice window.
-
Let's go ahead and add the username
for the GitHub,
-
for the git environment,
local git environment.
-
So we're going to enter
“git config --global user.name”.
-
And in this case,
-
my username is abeluserman.
-
Let's go ahead and hit Return.
-
We’ll next enter
-
my email.
-
And in this case, it will be
abel_user@hotmail.com.
-
We’ll next create a key that will
generate locally
-
and then we will copy over to the GitHub
environment.
-
And we do that by entering “ssh-keygen”.
-
We'll go ahead and enter, we’ll go
with the defaults again.
-
We will not set a passphrase.
-
And as you can see there, that
key has been created.
-
Next we’ll inspect that
key at the command line.
-
Let's go ahead and copy that key.
-
Now that we have the key in our
clipboard,
-
let's go ahead and go back to our account.
-
And let's go ahead and choose
the repository.
-
Well actually, we don't need to do that,
-
we can simply select the account pull
down there, the profile.
-
And let's go ahead and go to SSH keys.
-
And we’ll go ahead and
add a new SSH key.
-
We’ll call this “Windows Client VM”,
that's what this is.
-
I'm going to go ahead and paste here
the...nope.
-
Let me go ahead and paste the key.
-
And I'm gonna go ahead and add it.
-
Now let's go ahead and go back
to the Bash.
-
Let's go ahead and “clear”
the screen.
-
Let's go ahead and create a development
directory.
-
Call it “dev”.
-
“cd” into that.
-
So as you can see there, that's
what the path is now.
-
I've gone ahead and cleared the
screen.
-
Now we're going to go ahead and clone
that repository.
-
We do that by entering “git clone”,
-
and we're going to get the address
from a repository.
-
Let me go ahead and navigate to that now.
-
So it's just going to be abeluserman.
-
And I’m gonna click on the name
of the repository.
-
Then on “Clone or download”
and we're going to use the git address.
-
We're going to copy that to our clipboard.
-
Now I'm going to go ahead and
-
make sure I'm in the right spot
and paste that here.
-
And I'm going to go ahead
and hit Return.
-
If all goes well, we should pull
down those files.
-
So go ahead and look at the
directory structure.
-
And yes, we see "kali" there now.
-
Let's go ahead and enter into it.
-
And you can see there that we
have the files from the repository.
-
If we enter “ls” with a “-a” option,
we can see there that we have
-
the .gitignore as well.
-
So now, the next thing we're
going to do
-
is that we're going to add
a file to that repository.
-
Let's go ahead and open our file system.
-
And you can see there I am
already inside of the path.
-
I'm going to go ahead and select
kali, and I will simply add a new file.
-
Let's go ahead and do that.
-
We'll call it “hello”.
-
We’ll go ahead and open it.
-
And I think I used the wrong key.
-
There we go.
-
Let's go say, go ahead and say
“Hello World!”
-
Go ahead and close it.
-
Save it.
-
And now we've added
a file to our repository.
-
If we enter “git status” it'll say that
-
we have a new file that has not been
added.
-
We can now go ahead and add that.
-
We’ll say “add”.
-
If you do “.” you simply
add all of the files in your directory.
-
I'm simply going to
enter “hello” in this case “.txt”.
-
Now if we do “git status”, you'll see
that there is a new file now
-
that has been added.
-
The next thing we’ll do is we’ll enter
a git commit
-
with the “-m” option.
-
We need to provide some feedback.
-
And in this case, I'll say simply
“added hello.txt”.
-
Hit Return, and now we're ready
to push to the directory.
-
We'll go ahead and enter “git push”,
and this is the point in where,
-
if we added our keys correctly
and everything has been done correctly,
-
we will be able to see the commit.
-
Let's go ahead and enter Return.
-
And yes, you can see there that
the push was successful.
-
Let's go ahead and go over to our
repository.
-
And let's go ahead and reload the page.
-
If all went well, we
should be able to see our “hello”.
-
Now, if we click on it,
-
we should be able to see what we wrote.
-
And so if we review upon review what we
did, we created a GitHub account.
-
We then created a repository.
-
We then installed the “git cli”,
the command line interface.
-
We generated some keys.
-
We added that key that we generated, the
public key,
-
to the GitHub repository -- well not just
to the repository, but to the account.
-
We then cloned a repository to our
local machine.
-
We added a file and, as the last step,
-
we committed and pushed those
changes to the repository.
-
Go ahead and practice this a little bit.
-
Go through the cycle a couple times,
especially that of creating a repository,
-
cloning it to your local environment,
adding a file or two,
-
and then committing,
pushing those changes.