1 00:00:06,690 --> 00:00:09,570 - To work with Git, you need credentials. 2 00:00:09,570 --> 00:00:12,450 And you normally set these credentials up on the Git site 3 00:00:12,450 --> 00:00:13,710 that you want to use. 4 00:00:13,710 --> 00:00:18,090 You wanna use GitHub, go to github.com, create an account. 5 00:00:18,090 --> 00:00:20,763 This account is a username/password combination. 6 00:00:22,110 --> 00:00:24,780 And apart from username/password combination, 7 00:00:24,780 --> 00:00:27,750 strong credentials are becoming more common. 8 00:00:27,750 --> 00:00:29,550 And these strong credentials can be used 9 00:00:29,550 --> 00:00:32,103 as authentication tokens while working with Git. 10 00:00:33,330 --> 00:00:35,190 Tokens are also very useful 11 00:00:35,190 --> 00:00:37,740 while addressing the API directly. 12 00:00:37,740 --> 00:00:41,010 If you want to address the API directly from the software, 13 00:00:41,010 --> 00:00:43,470 there shouldn't be any username and password involved 14 00:00:43,470 --> 00:00:45,520 because who's going to type the password. 15 00:00:46,590 --> 00:00:49,080 And also in Git, two factor authentication 16 00:00:49,080 --> 00:00:50,610 has become common. 17 00:00:50,610 --> 00:00:53,400 And this is implemented through an authenticator app 18 00:00:53,400 --> 00:00:56,340 or by using SMS verification. 19 00:00:56,340 --> 00:00:59,403 Now let me show you how to create a personal access token. 20 00:01:02,310 --> 00:01:05,910 So here, I'm on github.com, I don't need to Sign Up. 21 00:01:05,910 --> 00:01:08,310 I already have an account, so I'm using Sign In. 22 00:01:10,560 --> 00:01:14,430 And here's my GitHub username and I am going to sign in. 23 00:01:14,430 --> 00:01:17,040 Now this is the two-factor authentication, and that means 24 00:01:17,040 --> 00:01:19,600 that I'm going to receive a message, on my phone 25 00:01:21,180 --> 00:01:25,980 and this message contains once-only code 26 00:01:25,980 --> 00:01:27,093 that I need to enter. 27 00:01:30,900 --> 00:01:33,029 And after verification, 28 00:01:33,029 --> 00:01:36,453 we can see that I'm in the Git environment. 29 00:01:37,590 --> 00:01:40,080 So I need to go to My Account. 30 00:01:40,080 --> 00:01:42,813 And in My Account, there is the Settings. 31 00:01:44,010 --> 00:01:47,520 And in the Settings, we have the Developer Settings, 32 00:01:47,520 --> 00:01:48,363 right here. 33 00:01:49,650 --> 00:01:51,300 And in the Developer Settings, 34 00:01:51,300 --> 00:01:53,943 there is the Personal Access Tokens. 35 00:01:55,020 --> 00:01:58,440 And this Personal Access Tokens, that's what we need. 36 00:01:58,440 --> 00:02:00,930 Now, I'm going to use the classic tokens. 37 00:02:00,930 --> 00:02:03,270 Fine-grained tokens are a new development. 38 00:02:03,270 --> 00:02:06,360 They're still in beta and in the fine-grained tokens, 39 00:02:06,360 --> 00:02:08,999 you can better identify which actions 40 00:02:08,999 --> 00:02:11,103 are allowed specifically. 41 00:02:12,180 --> 00:02:15,150 So here, you can see a couple of tokens that I already have. 42 00:02:15,150 --> 00:02:17,230 I am going to use generate new token 43 00:02:18,420 --> 00:02:21,813 and I want to use a new token, classic. 44 00:02:23,250 --> 00:02:24,300 Let me give you the name. 45 00:02:24,300 --> 00:02:25,980 February 23. 46 00:02:25,980 --> 00:02:29,699 By default, these tokens expire after 30 days. 47 00:02:29,699 --> 00:02:32,673 The expiration all depends on how you want to use it. 48 00:02:34,170 --> 00:02:37,680 If you don't need it to be the best possible security, 49 00:02:37,680 --> 00:02:40,683 just select no expiration, to make it easier on yourself. 50 00:02:41,820 --> 00:02:45,780 Now, next, we need to specify the scopes. 51 00:02:45,780 --> 00:02:48,780 The scope defines the access for the personal tokens, 52 00:02:48,780 --> 00:02:50,340 as you can see here. 53 00:02:50,340 --> 00:02:53,130 So I want the repo scope. 54 00:02:53,130 --> 00:02:54,543 I just want all scopes, 55 00:02:56,850 --> 00:02:58,443 including the admin scope. 56 00:02:59,730 --> 00:03:02,460 Within Git, you can work with role-based access control 57 00:03:02,460 --> 00:03:03,790 in a pretty decent way 58 00:03:04,663 --> 00:03:06,240 and I just want to make sure 59 00:03:06,240 --> 00:03:09,153 that I have access to everything that is possible. 60 00:03:16,320 --> 00:03:18,210 And then I click Generate Token. 61 00:03:18,210 --> 00:03:19,980 And after generating the token, 62 00:03:19,980 --> 00:03:22,080 we can see the token right here. 63 00:03:22,080 --> 00:03:24,030 I'm going to copy this token 64 00:03:24,030 --> 00:03:27,540 and I need to paste the token so that I can later use it. 65 00:03:27,540 --> 00:03:29,490 That's what I'm going to do on my Linux machine 66 00:03:29,490 --> 00:03:31,740 which is where I'm going to use these tokens. 67 00:03:35,072 --> 00:03:38,820 (keyboard clicking) 68 00:03:38,820 --> 00:03:40,383 I like to put them in a file. 69 00:03:44,430 --> 00:03:48,630 And that makes it easier to use the tokens later on. 70 00:03:48,630 --> 00:03:50,610 We will see, as we proceed, 71 00:03:50,610 --> 00:03:53,160 how this token is going to be used but, at least, 72 00:03:53,160 --> 00:03:54,690 we have a token at this moment 73 00:03:54,690 --> 00:03:56,290 and that's all that matters now. 74 00:03:58,584 --> 00:04:01,020 A relatively new feature that we need to talk about 75 00:04:01,020 --> 00:04:02,463 is the Credentials Cache. 76 00:04:03,300 --> 00:04:06,360 Because tokens are now the standard way to authenticate, 77 00:04:06,360 --> 00:04:09,000 the global username and password settings no longer work 78 00:04:09,000 --> 00:04:10,470 for authentication. 79 00:04:10,470 --> 00:04:12,570 So if you don't do anything, you'll be prompted 80 00:04:12,570 --> 00:04:14,770 for your username and password all the time. 81 00:04:15,780 --> 00:04:19,680 And that is why a Credentials Cache should be created, 82 00:04:19,680 --> 00:04:21,870 to cache your credentials. 83 00:04:21,870 --> 00:04:24,150 To do so, you need a gh client 84 00:04:24,150 --> 00:04:26,760 which is the GitHub client utility. 85 00:04:26,760 --> 00:04:28,770 And you use personal access tokens 86 00:04:28,770 --> 00:04:30,810 to establish your identity, 87 00:04:30,810 --> 00:04:32,580 that is stored in a credential cache 88 00:04:32,580 --> 00:04:35,330 and then you don't have to enter your username anymore. 89 00:04:36,570 --> 00:04:39,390 So let me demonstrate how to do. 90 00:04:39,390 --> 00:04:41,910 Here on the slide, we have the steps summarized. 91 00:04:41,910 --> 00:04:42,743 Let me show you. 92 00:04:47,700 --> 00:04:50,040 So here I am, in my browser, 93 00:04:50,040 --> 00:04:53,463 and I'm going to use install gh client. 94 00:04:54,450 --> 00:04:56,460 It's probably best to just Google it. 95 00:04:56,460 --> 00:04:59,103 Installation instructions, that's what I want. 96 00:05:01,440 --> 00:05:03,840 So here you can see the installation instructions 97 00:05:03,840 --> 00:05:06,390 for all the different operating systems 98 00:05:06,390 --> 00:05:09,783 and we are going to look for Linux. 99 00:05:10,680 --> 00:05:12,840 Linux installation instructions. 100 00:05:12,840 --> 00:05:14,490 There we go. 101 00:05:14,490 --> 00:05:16,860 So here you can see for the different distributions, 102 00:05:16,860 --> 00:05:18,210 what exactly to do. 103 00:05:18,210 --> 00:05:20,220 You can go for the manual installation. 104 00:05:20,220 --> 00:05:22,620 You can also use your Package Manager. 105 00:05:22,620 --> 00:05:24,540 Now, you can see that apparently on ubunto, 106 00:05:24,540 --> 00:05:26,340 you don't have to configure anything 107 00:05:26,340 --> 00:05:28,920 for Fedora, CentOS, and family. 108 00:05:28,920 --> 00:05:31,560 You need to install from the package repository 109 00:05:31,560 --> 00:05:34,620 for immediate access to the latest releases. 110 00:05:34,620 --> 00:05:38,013 So we need to add the repository first. 111 00:05:38,880 --> 00:05:43,080 So let me set up this repository stuff 112 00:05:43,080 --> 00:05:46,833 and install the gh client utility. 113 00:05:48,152 --> 00:05:51,235 (utility installing) 114 00:05:52,650 --> 00:05:54,513 So client utilities installed. 115 00:05:55,650 --> 00:05:58,830 Now I need a gh auth login, 116 00:05:58,830 --> 00:06:00,240 and that is the magical command 117 00:06:00,240 --> 00:06:03,240 that will create the Credentials Cache for us. 118 00:06:03,240 --> 00:06:05,760 Read carefully so that you're doing the right thing. 119 00:06:05,760 --> 00:06:08,760 So it wants to know which account I'm going to use. 120 00:06:08,760 --> 00:06:11,190 I'm going to use a github.com account. 121 00:06:11,190 --> 00:06:13,800 My preferred protocol is HTTPS. 122 00:06:13,800 --> 00:06:18,800 And yes, we want to authenticate with the Git credentials 123 00:06:20,910 --> 00:06:24,090 and I want to paste an authentication token 124 00:06:24,090 --> 00:06:26,283 and I'm pasting the authentication token. 125 00:06:28,080 --> 00:06:30,750 And there you can see based on the authentication token, 126 00:06:30,750 --> 00:06:31,620 it's logging me in. 127 00:06:31,620 --> 00:06:34,380 So it's telling me log in as sandervanvugt, 128 00:06:34,380 --> 00:06:37,020 so it knows me now and it means that I don't need 129 00:06:37,020 --> 00:06:39,870 this user information anymore. 130 00:06:39,870 --> 00:06:41,643 So let's go and use some Git.