- 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.
- 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