How to connect to GitHub with SSH

Connecting to Github with SSH eliminate needs of entering username and password for git interactions. This post describes How to connect to GitHub with SSH.

Step 1. Initialize SSH key

$ cd ~/.ssh
$ ssh-keygen -p
# Start the SSH key creation process
> Enter file in which the key is (/Users/you/.ssh/id_rsa): [Hit enter]
> Key has comment '/Users/you/.ssh/id_rsa'
> Enter new passphrase (empty for no passphrase): [Type new passphrase]
> Enter same passphrase again: [One more time for luck]
> Your identification has been saved with the new passphrase.

Step 2. Adding your SSH key to the ssh-agent

$ ssh-add ~/.ssh/id_rsa

Step 3. Adding a new SSH key to your GitHub account

$ cat ~/.ssh/id_rsa.pub
  1. Copy output of above
  2. In the upper-right corner of GitHub click your profile photo, then click Settings.
  3. In the user settings sidebar, click SSH and GPG keys.
  4. Click New SSH key or Add SSH key.
  5. Add description eg. your computer name
  6. Paste your key into the “Key” field.
  7. Click Add SSH key.

For Windows 10 Users

How To Install WSL on Windows 10

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *