To add a SSH key to GitHub it is necessary to work both in your computer and in GitHub web page. Lets start with the computer from which you want to commit code to your GitHub repositories. Later we will deal with GitHub.
@ your computer
First start by generating a ssh key. To generate a ssh key got to the command line and type:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/cadoado/.ssh/id_rsa): /Users/cadoado/.ssh/github_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/cadoado/.ssh/github_rsa.
Your public key has been saved in /Users/cadoado/.ssh/github_rsa.pub.
The key fingerprint is:
The key's randomart image is:
| . |
| + o B . |
|oo + . = & X |
|*o+ o S @ + |
|=o.o . * E o . |
|....= o = |
| .. + o |
|=o . |
The passphrase can be an empty string (just press Enter). Now you can check the key pair was generated: