How to setup SSH for GitHub repository

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good afternoon friends this is sergey kromchenko and today we're going to discuss ssh a lot of you have been added to repositories as contributors a lot of you have been creating your own repositories in a github gitlab bitbucket or any other repos and you want to connect to it through the ssh especially with the github because they have recently dropped support of the https or user username slash password as you know about it so how do we do that and why do we need it well whenever you want to pull repository or whenever you want to push your code to some repository you need to be authenticated to it pretty much you need to be logged in somehow to let github or gitlab or bitbucket know that you are exactly that user that has access to the private repository so how do you do that ssh is the way to do it ssh key pretty much allows you to be authenticated to the remote repository so you could push and pull code to it but before we get straight into it don't forget to give me that big fat thumb up subscribe to our channel below and join our instagram and telegram communities that you can find links in the description below [Music] situation number one someone have added you to github repository and you want to clone it as always you navigate here you click on ssh click here to copy the url then you navigate to your visual studio code type in get clone command v to paste it and hit enter and what do you see permission denied public key please make sure you have the correct access rights exactly you do not have ssh setup so let's follow up an instruction step number one let's google github generate ssh key right there and click on the first link when you click on the first link you you will you will open up a docs github.com url on a page and then you will see the following instruction so open your terminal and a paste following command and when you copy this command and paste it into your terminal please make sure to update url to the url i'm sorry please make sure to update your email address to the email address that you have used at your github account at your github.com account which in my case was let me see profile emails my email was cademifyaho.com so i'm going to go ahead come back to the vs code paste my email address and then hit enter so what this is going to do it's going to generate a public and a private key by the way it asks you to enter which to enter the file name which to save the key just hit enter that's the default option and that should be way enough second question would be enter your phrase so they're asking you to enter the passphrase i'm going to hit enter because there is no there is no passphrase needed i'm going to hit enter again and finally this is done we have created an ssh key for the for the email above okay i'm going to switch back to an instruction and see what is the next step so step two generated and then we scroll down adding your ssh key to your ssh agent we do not really need that what we need is to click on add a new ssh key on the left side scroll down just a little bit and copy this command whenever you copy this command please make sure not to copy dollar sign because it simply means we need to run it in a terminal so i'm going to switch back to the s code paste the command and hit enter after you run after you run this command your public key should have been copied into your clipboard which means if you will run command v anywhere you will paste your public key but let's come back to the browser and follow our instruction so step number two we need to navigate to the browser click on the github icon and then click on settings let's go ahead and do that click here click settings okay next step and then we need to in access section on the sidebar click on ssh and then click new ssh key so there should be we're going to scroll down let's see they have mentioned access sectioned access okay ssh and gpg keys perfect click here i'm going to remove an old one you do not have it this is just the testing one so you will see a screen that looks like this and you will need to click on new ssh key then call it whatever you want i'm going to call it local local key and then i'm going to paste it right here you can see my ssh key i'm going to remove it after this call so that that's why i can show it to you so you will not be able to use it in the future okay after you have pasted your code click on add ssh key awesome now you can see that your key was added and now we can come back to vs code and run our git clone command again which is right here i'm going to clear it first and then gonna run git clone and now as you can see we have successfully cloned the project sergi so now i'm going to run ls and you will see sergi so i can open it and do whatever i want with it this means that your local account now has an ssh key which is connected to your to your github account so at this point any any of the repositories you have access to like i can see on the left side you will be able to work with through your local you can close them you can clone them you can make changes and you can push changes changes if needed now let me talk a little a little bit more about ssh in depth so where do your keys get stored and what do you do if something is messed up well at the beginning we were at web projects folder so i'm going to run ls and you can see that we have we did clone surgery right but what if i run ls minus la so this command will show you also hidden files in this folder we do not have any hidden files but we do but we do have hidden ssh file in the root directory and in order to find it let's type in cd and hit enter now we're in the directory so now let's type in ls space minus la and when we hit this and we scroll up you will see that there is an a dot ssh folder let's go ahead and open it cd dot ssh now let's run ls and you can see your public key right here that's the one that you have connected through with your github remote github account on github.com so if you ever have an issue and you want to remove it what you could do simply if you want to start completely from scratch you navigate to your root directory run ls minus la to make sure that you do have that dot ssh folder and then let's scroll down and type in rm minus rf.ssh and what this did it just removed that ssh folder so now if i run ls minus la you see no more dot ssh folder right here and what does it mean this means that if we navigate back to our folder if we remove sergi folder and then we try to clone it again by running the same command git clone and then we paste it you're gonna and then we say yes you're going to see that we're getting same adder that there is no public key you have no access rights and then what we could do we could go back exactly to the same place where we came from and we could start from scratch also don't forget to remove your old ssh key since it was already removed from your local now we can navigate back and start all the way from the beginning now you know how to deal with the ssh and what is ssh used for and finally you know how to install or remove ssh keys from your computer it is as easy as that thank you for your time guys don't forget to give me the big fat thumb up subscribe to your channel below and join our communities on instagram and a telegram links to which you can find in the description below as well i'll see you next time
Info
Channel: Codemify
Views: 57,275
Rating: undefined out of 5
Keywords: qa, code, programming, python, visual studio, java script, job online, learn by coding, software engineer, software developer, html code, qa engineer, quality assurance, computer it programs, qa school, learn qa, codemify, wdio, qa bootcamp, learn qa online, how to become a qa engineer, qa tester, How to setup SSH for GitHub repository, github tutorial, github actions, ssh, github ssh, github, how to add ssh key to github, git ssh key, devops, github ssh key tutorial, gitlab
Id: snCP3c7wXw0
Channel Id: undefined
Length: 9min 57sec (597 seconds)
Published: Wed Feb 23 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.