1
00:00:00,000 --> 00:00:02,095
- [Narrator] Hi and
welcome back to the course.

2
00:00:02,095 --> 00:00:04,978
In this video we're going to
be creating our GitHub account.

3
00:00:04,978 --> 00:00:08,254
And that's fairly simple,
just go to github.com

4
00:00:08,254 --> 00:00:10,019
and then press the sign up button

5
00:00:10,019 --> 00:00:12,614
or put in your details in here.

6
00:00:12,614 --> 00:00:16,714
Once that's done you can
sign into your account.

7
00:00:16,714 --> 00:00:20,628
And then you can see
your repositories there,

8
00:00:20,628 --> 00:00:22,267
which you won't have any in the beginning,

9
00:00:22,267 --> 00:00:25,100
but you'll get some in the future.

10
00:00:26,993 --> 00:00:29,800
So just put in your username and password,

11
00:00:29,800 --> 00:00:31,899
and then you can sign in.

12
00:00:31,899 --> 00:00:33,082
And as you can see, I've got quite a lot

13
00:00:33,082 --> 00:00:35,466
of notifications and things going on here,

14
00:00:35,466 --> 00:00:38,045
but the most important parts are that

15
00:00:38,045 --> 00:00:40,911
you'll see your repositories
here on the right,

16
00:00:40,911 --> 00:00:43,678
you'll see repositories
that you contribute to

17
00:00:43,678 --> 00:00:46,035
but that you haven't created, and

18
00:00:46,035 --> 00:00:48,425
then you've got a feed of repositories

19
00:00:48,425 --> 00:00:51,014
and your collaborators.

20
00:00:51,014 --> 00:00:54,523
Let's just go to a new
repository at first.

21
00:00:54,523 --> 00:00:57,146
And we can create a new repository for

22
00:00:57,146 --> 00:01:00,146
testing things out, test-repository.

23
00:01:01,246 --> 00:01:03,681
You cannot create private repositories

24
00:01:03,681 --> 00:01:06,535
unless you pay or are a student.

25
00:01:06,535 --> 00:01:08,145
And so unfortunately the repository

26
00:01:08,145 --> 00:01:09,510
is going to have to be public,

27
00:01:09,510 --> 00:01:11,148
but that's not a bad thing.

28
00:01:11,148 --> 00:01:12,400
If your repositories are public,

29
00:01:12,400 --> 00:01:14,153
it means other people can look at them

30
00:01:14,153 --> 00:01:15,516
and that can help with things like jobs

31
00:01:15,516 --> 00:01:17,923
and things like that.

32
00:01:17,923 --> 00:01:20,011
You can put a description, let's say

33
00:01:20,011 --> 00:01:22,594
test repository for the course.

34
00:01:24,619 --> 00:01:27,936
And then press create repository.

35
00:01:27,936 --> 00:01:31,550
Then you've got a quick set-up to do.

36
00:01:31,550 --> 00:01:34,842
Now, you can do a bunch of things now

37
00:01:34,842 --> 00:01:37,295
that you've created your repository.

38
00:01:37,295 --> 00:01:39,808
You can download the repository

39
00:01:39,808 --> 00:01:43,975
and that will initialise
a new repository locally.

40
00:01:45,869 --> 00:01:49,952
Or, you can use this
repository as a remote host.

41
00:01:51,002 --> 00:01:54,728
Since we've already created
our repository locally,

42
00:01:54,728 --> 00:01:57,730
we're going to do the latter.

43
00:01:57,730 --> 00:02:00,683
And it tells you here exactly what to do.

44
00:02:00,683 --> 00:02:04,425
So, push an existing repository
from the command line.

45
00:02:04,425 --> 00:02:08,946
So what we're going to do is
add this remote repository

46
00:02:08,946 --> 00:02:13,142
as a remote repository
to our local repository.

47
00:02:13,142 --> 00:02:14,394
That sounded very confusing.

48
00:02:14,394 --> 00:02:15,896
The first thing to do however,

49
00:02:15,896 --> 00:02:17,891
is to not follow this code exactly

50
00:02:17,891 --> 00:02:19,747
because this code here requires some

51
00:02:19,747 --> 00:02:22,521
special permissions, SSH
keys and things like that,

52
00:02:22,521 --> 00:02:24,080
that we're going to look at later.

53
00:02:24,080 --> 00:02:27,165
So what to do is to
select the HTTPS version,

54
00:02:27,165 --> 00:02:31,172
so press this button here
and then copy that there.

55
00:02:31,172 --> 00:02:32,925
Then let's go over to the terminal,

56
00:02:32,925 --> 00:02:36,675
and we are going to say
git remote add origin

57
00:02:38,025 --> 00:02:40,442
and paste that code in there.

58
00:02:42,868 --> 00:02:47,658
Then press enter and that's
your remote repository added.

59
00:02:47,658 --> 00:02:51,825
Now, if we want to push our
code to that remote repository,

60
00:02:53,641 --> 00:02:56,679
our commits, rather, we can do that,

61
00:02:56,679 --> 00:02:58,262
just type git push.

62
00:03:00,022 --> 00:03:02,323
And what that'll do is
that it'll automatically

63
00:03:02,323 --> 00:03:05,104
see that origin exists
and it will get your

64
00:03:05,104 --> 00:03:08,341
master branch with all the commits that

65
00:03:08,341 --> 00:03:10,564
the master branch has; it will push them

66
00:03:10,564 --> 00:03:13,540
and put them in the remote repository.

67
00:03:13,540 --> 00:03:17,707
Now, this may fail because
the current branch master

68
00:03:19,248 --> 00:03:21,842
has no upstream branch.

69
00:03:21,842 --> 00:03:23,417
That means that because
the remote repository

70
00:03:23,417 --> 00:03:27,231
has just been created,
you need to make sure

71
00:03:27,231 --> 00:03:29,732
that the remote repository
also has a branch

72
00:03:29,732 --> 00:03:31,850
called master in it.

73
00:03:31,850 --> 00:03:33,366
And because it doesn't right now,

74
00:03:33,366 --> 00:03:35,449
we need to run this code.

75
00:03:39,469 --> 00:03:42,451
And now we have to put in
our username and password,

76
00:03:42,451 --> 00:03:44,327
so let's do that.

77
00:03:44,327 --> 00:03:46,496
My username is jslvtr and I'm gonna

78
00:03:46,496 --> 00:03:48,579
type my password in here.

79
00:03:52,658 --> 00:03:55,173
And then we start pushing.

80
00:03:55,173 --> 00:03:57,659
So, we've counted the objects and

81
00:03:57,659 --> 00:04:00,063
then we've written them
to the remote repository,

82
00:04:00,063 --> 00:04:02,757
and it tells you kind
of what you've written

83
00:04:02,757 --> 00:04:05,228
and where it's put it.

84
00:04:05,228 --> 00:04:06,599
And it also says that
it's created a new branch

85
00:04:06,599 --> 00:04:08,463
on the remote repository that is

86
00:04:08,463 --> 00:04:11,663
tracking your local master branch

87
00:04:11,663 --> 00:04:14,488
with the same name, so it says

88
00:04:14,488 --> 00:04:16,661
branch master set up to track remote

89
00:04:16,661 --> 00:04:18,828
branch master from origin.

90
00:04:20,079 --> 00:04:23,048
Okay, so if we do a git status now,

91
00:04:23,048 --> 00:04:25,415
it says that your branch is up-to-date

92
00:04:25,415 --> 00:04:28,141
with origin/master.

93
00:04:28,141 --> 00:04:31,292
Notice how it doesn't say origin/master

94
00:04:31,292 --> 00:04:32,938
is up-to-date with your branch,

95
00:04:32,938 --> 00:04:35,595
because the central repository now is

96
00:04:35,595 --> 00:04:38,099
the GitHub repository, and what that means

97
00:04:38,099 --> 00:04:40,357
is that if you work with other people,

98
00:04:40,357 --> 00:04:43,727
and they also make changes, you can then

99
00:04:43,727 --> 00:04:48,499
download those changes
from the remote repository.

100
00:04:48,499 --> 00:04:50,834
All you would have to
do to download changes

101
00:04:50,834 --> 00:04:54,264
from the remote repository
is to run git pull

102
00:04:54,264 --> 00:04:56,365
and that would download any changes from

103
00:04:56,365 --> 00:05:00,185
the remote repository into
your local repository,

104
00:05:00,185 --> 00:05:02,079
however you have to be careful

105
00:05:02,079 --> 00:05:03,626
that nobody else has deleted any

106
00:05:03,626 --> 00:05:05,843
of the code that you wrote in the

107
00:05:05,843 --> 00:05:08,366
changes that you have locally.

108
00:05:08,366 --> 00:05:11,204
So we're going to talk about
that a bit more in detail.

109
00:05:11,204 --> 00:05:12,741
But that's it for this video.

110
00:05:12,741 --> 00:05:14,218
Hopefully you learned something,

111
00:05:14,218 --> 00:05:16,093
how to set these things up.

112
00:05:16,093 --> 00:05:17,622
And I'll see you in the very next one.

