WEBVTT
Kind: captions
Language: en

00:00:00.199 --> 00:00:04.950
Now that we've initialized our git
project locally on our machine we can go

00:00:04.950 --> 00:00:07.380
ahead and push this code to Github

00:00:07.380 --> 00:00:10.019
Pushing to github comes in really useful if

00:00:10.019 --> 00:00:14.040
you need to ask for any questions on the
Q&amp;A because you can just link to your

00:00:14.040 --> 00:00:18.000
project source code on github and then I
can take a look at the code and see if I

00:00:18.000 --> 00:00:20.620
can figure out where the problem might
be

00:00:20.620 --> 00:00:22.109
just note that anything you push to

00:00:22.109 --> 00:00:26.160
github will be publicly available so be
careful not to commit any secret keys or

00:00:26.160 --> 00:00:28.660
passwords with your project

00:00:28.660 --> 00:00:30.929
okay so
let's go ahead and push our project

00:00:30.929 --> 00:00:32.940
to github

00:00:32.940 --> 00:00:37.980
we need to start by creating a
public/private key pair let's start by

00:00:37.980 --> 00:00:44.489
typing in our terminal or git bash
window LS tilde forward slash dot SSH

00:00:44.489 --> 00:00:48.840
and hit enter just to make sure we don't
have any existing keys in our SSH

00:00:48.840 --> 00:00:50.360
directory

00:00:50.360 --> 00:00:55.230
By default the SSH directory
is where all public private SSH keys are

00:00:55.230 --> 00:01:00.120
created on the system and this should be
the same for Mac or if you're using a

00:01:00.120 --> 00:01:04.110
Windows and you're using the git bash
since we don't have any existing keys

00:01:04.110 --> 00:01:12.950
we're going to go ahead and create a new
key by typing SSH - key gen - T RSA

00:01:12.950 --> 00:01:21.200
- B 409 6 - capital C and then our email
address so I'm going to put

00:01:21.200 --> 00:01:23.940
mark@londonappdeveloper.com

00:01:25.700 --> 00:01:28.979
what this
command does is it runs the SSH key gen

00:01:28.979 --> 00:01:34.380
tool and then it says we want to create
a new key with a type RSA that's the

00:01:34.380 --> 00:01:38.180
type of key that we're creating and we
want to create a key that is

00:01:38.180 --> 00:01:41.080
4096 bytes

00:01:41.080 --> 00:01:45.060
then this - C and this
message here is just the comment so we

00:01:45.060 --> 00:01:49.322
can identify what key this is for if we
ever need to check it

00:01:49.322 --> 00:01:50.579
okay so if you hit

00:01:50.579 --> 00:01:55.380
enter it will generate the key pair and
by default it will create it in your

00:01:55.380 --> 00:02:01.200
home directory forward slash SSH and then ID
RSA this is the default key for your

00:02:01.200 --> 00:02:05.880
system and I recommend leaving this as
default for this course

00:02:05.880 --> 00:02:06.810
now you can

00:02:06.810 --> 00:02:11.430
create an optional passphrase for your
key and I always recommend creating a

00:02:11.430 --> 00:02:15.430
passphrase this adds an
extra layer of security on your key so

00:02:15.430 --> 00:02:19.930
if somebody manages to steal the key
from your computer they won't be able to

00:02:19.930 --> 00:02:22.320
use it without the passphrase

00:02:22.320 --> 00:02:24.220
for the
purpose of this course I'm going to leave

00:02:24.220 --> 00:02:27.370
this blank but feel free to enter a
passphrase if you want to use a

00:02:27.370 --> 00:02:31.180
passphrase to protect your key

00:02:31.180 --> 00:02:33.670
okay now
you can see that our key has been

00:02:33.670 --> 00:02:38.080
created and we have these two new files
created in our SSH directory let's

00:02:38.080 --> 00:02:43.480
just type LS tilde forward slash dot
SSH again and let's check that these

00:02:43.480 --> 00:02:44.880
files exist

00:02:44.880 --> 00:02:50.410
Okay so the ID RSA file here
is the private key now you want to make

00:02:50.410 --> 00:02:54.190
sure you never share the contents with
this key or the file with anyone else

00:02:54.190 --> 00:02:57.970
you want to keep this safe at all times
because this is basically like your

00:02:57.970 --> 00:02:59.720
password

00:02:59.720 --> 00:03:04.180
the id_rsa.pub key is the
public key this is the key that you can

00:03:04.180 --> 00:03:08.209
upload to services like github in order
to authenticate

00:03:08.209 --> 00:03:09.820
okay so now that we've

00:03:09.820 --> 00:03:14.650
generated our key let's go ahead and
head over to github.com which I've

00:03:14.650 --> 00:03:17.940
linked to in the resources and login
with your account

00:03:17.940 --> 00:03:18.940
now we need to add our

00:03:18.940 --> 00:03:23.350
public key to our account so click on
your profile here on the top right and

00:03:23.350 --> 00:03:27.400
then click on settings

00:03:27.400 --> 00:03:30.160
in the settings
menu on the left you should see this SSH

00:03:30.160 --> 00:03:35.860
and GPG keys so click on that and this
is where we can add SSH keys to our

00:03:35.860 --> 00:03:41.470
account so let's click new SSH key and
then let's head back to our terminal or

00:03:41.470 --> 00:03:47.530
git bash and we're going to output our
public key by using this CAT or cat

00:03:47.530 --> 00:03:58.080
command so type cat tilde forward slash dot
SSH forward slash ID underscore RSA dot pub

00:03:58.080 --> 00:04:02.260
and again remember to include the dot
pub when you output the key because

00:04:02.260 --> 00:04:05.956
you don't want to share your private key with anyone

00:04:05.956 --> 00:04:06.880
okay when you

00:04:06.880 --> 00:04:11.170
hit enter you should see this random
string of text here ending in the

00:04:11.170 --> 00:04:18.130
comment we provided in the -
capital C part of our command here so

00:04:18.130 --> 00:04:22.780
this is our public key now make sure you
copy it right from the beginning to the

00:04:22.780 --> 00:04:26.890
end you don't want to miss any because otherwise
it won't work properly so it's from the

00:04:26.890 --> 00:04:29.530
SSH RSA all the way to the end of our

00:04:29.530 --> 00:04:34.150
comment here I'm going to do right click
copy and then let's head over to our

00:04:34.150 --> 00:04:37.940
github page and paste this in

00:04:37.940 --> 00:04:40.600
okay so
we've pasted the contents of the key now

00:04:40.600 --> 00:04:44.650
let's just call the key but give the key
the title of the machine that we're

00:04:44.650 --> 00:04:50.620
authenticating with this key so in my
case this is mark laptop

00:04:50.620 --> 00:04:51.400
okay now click

00:04:51.400 --> 00:04:56.020
add SSH key and it should add the key to
our account here so you can see we've

00:04:56.020 --> 00:05:00.250
got mark laptop and then it's got added
on the 6th of April which is the day

00:05:00.250 --> 00:05:03.080
that I added it just now

00:05:03.080 --> 00:05:06.070
okay now that
we've set up authentication we should be

00:05:06.070 --> 00:05:11.139
able to push the project to github so
let's head back to the github home page

00:05:11.140 --> 00:05:16.260
and let's create a new project for our
project

00:05:16.260 --> 00:05:17.169
we're going to call our

00:05:17.169 --> 00:05:25.870
repository profiles - rest - API and we
can give it the description source

00:05:25.870 --> 00:05:31.520
code for profiles rest api course

00:05:31.520 --> 00:05:33.580
we're
going to leave it as public and we're

00:05:33.580 --> 00:05:38.410
going to uncheck or leave unchecked the
initialize this repository with a readme

00:05:38.410 --> 00:05:41.260
because we've already created these
files in our project in the previous

00:05:41.260 --> 00:05:46.840
video so let's click create repository
and then this should take us to this

00:05:46.840 --> 00:05:54.160
page which explains how we can add our
remote to our local git project so we

00:05:54.160 --> 00:05:59.200
want to use this instruction here which
is push an existing repository from the

00:05:59.200 --> 00:06:03.039
command line because we already have our
local repository we already have it

00:06:03.039 --> 00:06:06.820
initialized we've already done most of
these steps here so we just need to do

00:06:06.820 --> 00:06:12.250
these two commands which will configure
our project with the correct remote URL

00:06:12.250 --> 00:06:15.080
and then push our project to github

00:06:15.080 --> 00:06:17.530
so
let's go ahead and copy this first

00:06:17.530 --> 00:06:21.720
command git remote add origin

00:06:21.720 --> 00:06:24.669
head over
to our terminal or git bash and make sure

00:06:24.669 --> 00:06:29.020
that we're currently in our project
location that is the profiles rest api

00:06:29.020 --> 00:06:34.100
git project and paste in the command and
hit enter

00:06:34.100 --> 00:06:35.919
so this configures our project

00:06:35.919 --> 00:06:40.810
to add a new remote origin with the path
of our remote

00:06:40.810 --> 00:06:42.380
git project

00:06:42.380 --> 00:06:47.080
next let's copy this command
below and head back to the terminal or git

00:06:47.080 --> 00:06:51.880
bash paste it in and this should prompt
you if you haven't connected to github

00:06:51.880 --> 00:06:55.990
before it will prompt you if you want to
allow this new fingerprint so just click

00:06:55.990 --> 00:07:00.850
yes you should only need to do this the
first time you push and now you can see

00:07:00.850 --> 00:07:06.100
that it has pushed a new branch, the
master branch up to our project so now

00:07:06.100 --> 00:07:11.680
we go back to git and we refresh we
should see the files that we created on

00:07:11.680 --> 00:07:17.080
a local machine appear in our git
project so that's how you push a project

00:07:17.080 --> 00:07:19.530
to github

