DEV Community

Viraj Lakshitha Bandara
Viraj Lakshitha Bandara

Posted on

Setup New SSH Key for GitHub

  • Run Commands in GitBash

Check for Exisiting SSH keys

ls -al /.ssh
Enter fullscreen mode Exit fullscreen mode

Lists the files in your .ssh directory, if they exist

Generate New SSH Key

1st : ssh-keygen -t rsa -b 4096 -C "<Enter Email Address>" and Hit Enter
2nd : Enter passpharse if needed (If not hit enter)
3rd : Repeat same passpharse
Enter fullscreen mode Exit fullscreen mode

Adding your SHH key to the ssh-agent

1st : eval $(ssh-agent -s)
2nd : ssh-add ~/.ssh/id_rsa
Enter fullscreen mode Exit fullscreen mode

Copy Key to Clipboard

clip < ~/.ssh/id_rsa.pub
Enter fullscreen mode Exit fullscreen mode

Setup SSH key in Github

  1. Open SSH Key Page and Click on New SSH Key
  2. Add Title to Nickname for the SSH Key (eg: Personal Laptop)
  3. Paste Key from Clipboard
  4. Click on Add SSH Key

Discussion (0)