GitHub Add SSH

Git GitHub Add SSH

Copy the SSH Public Key

We will be using the clip < command to copy the public key to the clipboard:

Example

[user@localhost] $ clip < /Users/user/.ssh/id_rsa.pub

Go to GitHub, move to the top left corner, click your profile, and select  Settings:

github setting

 Select “SSH and GPG keys”. and click the “New SSH key” button:

Select a title, paste the public SSH key into the “Key” field, and click “Add SSH Key”:

You will be asked to enter the GitHub password.

Now, the new SSH key is added:

SSH-keys

Test SSH Connection to GitHub

The connection can be tested through SSH to GitHub:

[user@localhost] $ ssh -T git@github.com

The authenticity of host ‘github.com (140.82.121.3)’ can’t be established.

RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added ‘github.com,140.82.121.3’ (RSA) to the list of known hosts.

Hi webhostguru! You’ve successfully authenticated, but GitHub does not provide shell access.

The last line consists of the username on GitHub, which means you are successfully authenticated.

Add New GitHub SSH Remote

Now, add a new remote via SSH to our Git.

Firstly, we will get the SSH address from our repository on GitHub:

ssh-remote

Then use that address to add a new origin:

Example:

[user@localhost] $

git remote add ssh-origin git@github.com:webhostguru/hello-world.git