how to add rsa key to github

how to add rsa key to github

How to set up SSH Key so that you don't have to type your username and password when you want to push to GitHub.

Open up your gitbash, if you don't have it installed on your PC, you can download it by clicking on this link https://git-scm.com/downloads

type this command to generate the ssh key

  $ ssh-keygen -t rsa -b 4096 -C "youremailaddress@host.com"

it'll show you this

Generating public/private rsa key pair.
Enter file in which to save the key (/c/user/yourname/.ssh/id_rsa):

then press your enter button to save it. It'll ask to enter your passphrase

Note: When you're typing your passphrase it won't show you the keys or words you type in. just know/remember what you typed

Enter passphrase (empty for no phrase):
Enter same passphrase again:

passphrase is like your password whenever you want to pull or push to github you'll be asked to enter it.

Now Your Keys have been generated. it's time you let your computer know that you want to use this key

First you need to start the ssh agent by typing

$ eval $(ssh-agent -s)

it's time to add the ssh key. Remember you must be on this part

*C:\Users\Owner\

$ ssh add ~/.ssh/id_rsa
Enter the passphrase for /c/users/owner/.ssh/id_rsa:

Now it has been added.

Now you need to copy the public key to your clipboard and add it your github account

$ clip < ~/.ssh/id_rsa.pub

Now you've copied the public key

  1. Go to your github account and click on your profile picture

  2. Go to settings

  3. Click on SSH and GPG Keys

  4. Then give it a title. e.g first ssh key

  5. Paste the public key you copied

  6. and click on add ssh key or save button

Congratulations. You've added your first ssh key to github