punixcorn / how-to-add-ssh-key-to-your-computer

a Repo, which explains and gives instructions on how to make ssh keys and link them with your github account so you can push from the github command line tool git-bash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

For more info visit GitHub docs

CREATING AND ADDING YOUR SSH KEY TO GITHUB

Check for an ssh key ::

open git bash and type :

 ls -al ~/.ssh

if you see these:
id_rsa.pub
id_ecdsa.pub
id_ed25519.pub

then you have the keys all you have to do is to link the key.
else if you don't
then you need to generate a new key

Generating a new ssh key if you didn't find one

in git bash type :

    ssh-keygen -t ed25519 -C "your_email@example.com"

if you are using a legacy system use:(if you dont know just use the one above)

    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

this will create a new SSH key with the email attached but it will ask you some things, just keep pressing enter or you can do otherwise

Adding the SSH key to the SSH agent::

in git bash type :

eval "$(ssh-agent -s)" 
ssh-add ~/.ssh/id_ed25519

Adding the SSH key to your GitHub account

1.using the website:

copy the ssh key using in git bash :

clip < ~/.ssh/id_ed25519.pub

Go to your github page
In the upper-right corner of any page, click your profile photo, then click Settings > Acess


New SSH key or Add SSH key


In the title, you can add a description like, macbook key, or windows key and in the key `paste` what you copied using CTRL + V


then click add SSH key

then input your password to confirm

2.using the (cli tool) git-bash visit the GitHub Docs(Adding a new SSH key to your GitHub account using the cli tool) for more detailed info and instructions

Testing if it worked

in git bash type :

ssh -T git@github.com

you will see a this

> The authenticity of host 'github.com (IP ADDRESS)' can't be established.
> RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
> Are you sure you want to continue connecting (yes/no)?

Verify that the fingerprint in the message you see matches GitHub's public key fingerprint. If it does, then type yes
the you will see this

> Hi username! You've successfully authenticated, but GitHub does not
> provide shell access.

where username is your username

If all works Yay you have successfully linked your github cli tool to your github account


images gotten from the GITHUB DOCS

About

a Repo, which explains and gives instructions on how to make ssh keys and link them with your github account so you can push from the github command line tool git-bash


Languages

Language:Shell 100.0%