It's from help.github.com.
Step 1: Check for SSH keys
$ cd ~/.ssh $ ls -al #Lists the files in your .ssh directory
Check the directory listing to see if you have files named wither id_rsa.pub or id_dsa.pub. If you don't have either of those files go to step 2. Otherwise. you can skip to step 3.
Step 2: generate a new SSH Key
To generate a new SSH key, copy and paste the text below, making sure to substitute in your email.
The default settings are preferred, so when you're asked to "enter a file in which to save the key, "" just press enter to continue.
$ ssh-keygen -t rsa -C "firstname.lastname@example.org" # Creates a new ssh key, using the provided email as a label Generating public/private rya key pair. Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
Next, you'll be asked to enter a passphrase.
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
Which should give you something like this:
Your identification has been saved in /Users/you/.ssh/id_rsa. Your public key has been saved in /Users/you/.ssh/id_rsa.pub. The key fingerprint is : 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db email@example.com
Then add your new key to the ssh-agent:
$ ssh-add ~/.ssh/id_rsa