Skip to content

Instantly share code, notes, and snippets.

@rimatla
Last active August 11, 2020 17:44
Show Gist options
  • Save rimatla/320d7e22fc36c5e8e472a470e6eb677f to your computer and use it in GitHub Desktop.
Save rimatla/320d7e22fc36c5e8e472a470e6eb677f to your computer and use it in GitHub Desktop.
SSH Setup for Mac + Github

On Terminal

  • To generate an ssh key:

cd ~/

ssh-keygen -t rsa

  • Press enter to accept the default filename (/Users/you/.ssh/id_rsa)
  • Prompt asks you to create a passphrase. This is optional, either create a passphrase or press enter for no passphrase
  • After pressing enter, two files will be created ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub
  • Public key will be stored in the file ending with .pub i.e. ~/.ssh/id_rsa.pub
  • Copy public SSH key pbcopy < ~/.ssh/id_rsa.pub
  • Press enter
  • This will copy the contents of the id_rsa.pub file to your clipboard.

On Github

  • Once you have copied your public SSH key, login to your GitHub account and go to https://github.com/settings/profile
  • On the left-hand side menu, you will see a link SSH and GPG keys
  • Click on that link which will take you to a page where you can enter your public SSH key that you copied earlier.
  • Click on New SSH key
  • Enter a title name
  • Paste the public SSH key in the key textbox
  • Click Add SSH key
  • Test your GitHub authorization by attempting to clone a repo in your terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment