Add MacOS High Sierra v10 SSH Key to GitHub

Profile picture for user devraj

Many Git servers authenticate using SSH public keys. 

In order to provide a public key, each user in your system must generate one if they don't already have one. This process is similar across all operating systems.

When you set up SSH, you create a key pair that contains a private key (saved to your local computer) and a public key (uploaded to GitHub).

This two-way mechanism prevents man-in-the-middle attacks. Follow below steps to add your MacOS SSH key to GitHub:

Step 1: Type below command to generate SSH key if not already generated

$ ssh-keygen -b 4096

Step 2: Press Enter when it ask for "Enter file in which to save the key..." to add ssh key to default location.

Step 3: Enter passphrase, combination of chars which you can remember.

Step 4: Enter passphrase again.

Step 5: Go to .ssh directory

$ cd ~/.ssh

Step 6: Copy public ssh key

$ pbcopy <

Step 7: Login to your git account and click on User Menu and then "Settings".

Step 8: Click on "SSH and GPG keys" link under "Personal settings" section

Step 9: Click on "New SSH Key" Button

Step 10: Paste SSH key which you copied earlier

Step 11: Click on "Add SSH key" button