Fixing the Github Permission denied issue | Github SSH Key setup

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody this video is not directly related to any specific AI tool but it's an important step for anybody trying to set up a GitHub repo locally on their computer the reason I'm making this video is when beginners try to set up something like baby AGI on their local computer and try to clone it like this they might face a connection issue because they have not set up their SSH Keys properly so for example if they try to clone that repo using this command called git clone if your SSH keys are not set up correctly you're going to see this message called permission denied public key please make sure you have the correct access rights and that the repository exists basically What's Happening Here is that GitHub cannot recognize your computer because you probably have not set up your SSH Keys correctly so hopefully by the end of this video you're going to be able to clone any repo from GitHub and use it locally before we get started if this is your first time to my Channel I want to welcome you and wreck recommend you to sign up to my AI newsletter I'm working on a few AI workflows that I create for myself to solve different problems and I'm soon gonna start sending these out on this newsletter alright let's get started so what exactly is SSH it stands for secure shell and when you connect via SSH you can authenticate using a private key file on a local machine so what we're going to do is we're going to generate an SSH key locally which is going to have a public version of that key and the private version of that key and we're going to provide the public version of that key on your GitHub account so when you try to clone something from GitHub like BP he is open source repo it's going to recognize that public key in your GitHub account and pair it with the private key in your local computer and recognize your local machine and then it will let you download that repo so the first step you have to do aside from having a GitHub account ready so if you don't have one already make sure to create one on github.com and in your local computer just open your terminal here I'm using item 2 on a Mac but you can of course use the basic terminal which comes with your computer after that we're going to copy this command using the email that you used to create your GitHub account so I'm going to paste that right there remove this dummy email I'm going to type the email that I have for my GitHub account and when I press enter it says generating a public and private key pair and this is what I meant it's going to create two keys one will be private that you should not share with anybody and one will be public that you can add to your GitHub account later for this one you don't really need to specify any file you can just press enter and also you don't need to specify any passphrase so I'm going to press enter again and since I did not enter any passphrase I'm going to press enter again all right it says your identification has been saved inside this folder your public key has been saved in this file which ends with DOT Pub that means public then you have two sets of characters which is the fingerprint of the key you don't need to worry about these these are just for the computer the next step is to start the SSH agent in the background for that you just copy this Command right here paste it right there and press enter now technically your public and private key combination has been created and if you're using Mac OS Sierra 10.12 or later which I am and most of you probably will you will need to modify this file called dot ssh-config so first I'm going to check if this file exists already and for most cases if you're new this would probably not exist so I'm going to first try this command and press enter it says the file config does not exist like I expected the next step is to just open this destination called config on any kind of editor like touch or Nano or vim and it's going to get generated automatically so I'm going to use Nano instead of touch and when you open it up you're going to have to paste this section right here where it tells your computer that for this host like anything coming from github.com you're going to allow them access to the private key that you have locally on your computer so first I'm going to open this destination using Nano because that's what I prefer and as soon as I open it it's going to get generated and now I can just copy this section right here and paste it right there after that I'm going to do a control X that means it's going to save and exit I'm going to press y that means yes so if I go back and try to open it this time it's going to open it up as you see right here instead of saying this file does not exist I have all of this setup done now I'm going to add that private key to the SSH agent and store it in my keychain for my Mac so I'm going to use this Command right here and paste it and press enter it says identity added so my private key is now added to my keychain so now my public key is ready to go so if I do an open on the SSH folder and press return it's going to open up this folder called dot SSH as you see here there's two keys right there the first one is the private key that should not be shared with anybody and the second one is the public key so if I open this file using a text editor you're going to see this long combination of characters which is your public key all you do is copy it right there and now you can close this file and close this folder and now make sure you're logged in on your GitHub account go on the right and press settings when you go on settings go on the left and go to the section called SSH and gpg keys it's going to show all the SSH keys that are connected to your GitHub account I already have it connected to my second computer called Mac 4GB I'm going to click add new SSH key on the top call it Mac 8GB because this laptop has 8 gigs of RAM I'm gonna paste that key that I just generated the public one and click add SSH key now sometimes it might require you to do this additional step where you get an SMS on your phone that you connected to your GitHub account so I'm going to click Send SMS I'm going to check my phone paste the code I found and now I'm verified as you see here my computer just got added to my GitHub account using the public key that I generated just now so now all the steps are done for connecting my computer to my GitHub account so technically I should be able to clone this repo now so I'm going to copy this GitHub repo right here I'm going to type get clone and press enter all right perfect now as you see I'm not getting any permission issues my GitHub repo from baby AGI is now downloading on my computer happily and my local SSAT setup is ready to go now if you're a beginner this kind of looks complicated but it's really not all you're doing is generating a unique key combination on your local computer and telling GitHub that you're a real person and GitHub should allow different repos to get downloaded to your local computer and if you have been stuck on this step like I know some people have been you are not free to start cloning all kinds of repos like Auto GPT and baby AGI and start playing around with it on your local computer alright that's all I have for today's video If you do face any issues make sure to add a comment so me or someone else will be able to solve it and if you did get some value from this video make sure to subscribe to my newsletter and my YouTube channel and click like on this video till the next one thank you so much foreign [Music]
Info
Channel: Testing AI
Views: 21,028
Rating: undefined out of 5
Keywords: Testing AI, Artificial Intelligence, AI, github ssh permission, permission denied publickey mac, permission denied publickey fatal could not read from remote repository, git clone permission denied, gpt4, open ai, chat gpt, could not read from remote repository, permission denied public key, git, github, Personal Access Tokens in GitHub, git push permission denied 403, GitHub Error, solved permission error, github permission error solved, fatal: could not read from remote repository
Id: TviP5rCZiy0
Channel Id: undefined
Length: 8min 2sec (482 seconds)
Published: Sun May 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.