Adding SSH key for GitHub

Guide how to add ssh key to config file for GitHub

Generate Key in Terminal

#!/bin/bash
#Generating public/private rsa key pair.
#Enter file in which to save the key (/Users/superuser/.ssh/id_rsa): id_rsa_github
#Enter passphrase (empty for no passphrase):
#Enter same passphrase again:
#Your identification has been saved in id_rsa_github
#Your public key has been saved in id_rsa_github.pub

cd ~
ssh-keygen -t rsa -b 4096 -C "your.email@domain.com"
cat ~/.ssh/id_rsa.pub

echo "Paste this key on your GH page:"
echo "https://github.com/settings/keys"
echo "********** Done **********"

Add url record to ssh config

Add following strings at the end of file ~/.ssh/id_rsa):

Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github

Add key to GitHub Settings

Settings Page on GitHub with keys

img1

Verify that push/pull working

git pull
git push