Other Pages

Expand All

Create An SSH Key

An SSH key uniquely identifies you (and your computer) when your computer is communicating with other computers. Think of an SSH key as a fancy password.

You'll need one of these to create your Heroku and Github accounts.

Option 1: Did you use RailsInstaller on Windows?

Congratulations, you already have an ssh key!

Option 2: Do you have a preexisting SSH key for some other reason?

Maybe you went to a previous RailsBridge workshop, or generated an SSH key to push some code to GitHub? You can check with the following command:

Type this in the terminal:
ls ~/.ssh/id_rsa

If you see the message No such file or directory, you don't have an SSH key yet.

'No such file or directory'
'/Users/[something]/.ssh/id_rsa'

Option 3: Generate an SSH key

Use the same email address for heroku, git, github, and ssh.

REPLACE student@example.com with your actual email address below.

Type this in the terminal:
ssh-keygen -C student@example.com -t rsa

Press enter to accept the default key save location.

Next, you'll be asked for a keyphrase.

Choose whether to use a keyphrase

No keyphrase

Hit enter to accept blank passphrase, then hit enter again.

Keyphrase

If your computer is shared with other people, as in a work laptop, you should choose and enter a real passphrase. Twice.

After key generation is complete, you'll have output that looks like this.

Expected result:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/student/.ssh/id_rsa):
Created directory '/Users/student/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/student/.ssh/id_rsa.
Your public key has been saved in /Users/student/.ssh/id_rsa.pub.
The key fingerprint is:
88:54:ab:77:fe:5c:c3:7s:14:37:28:8c:1d:ef:2a:8d student@example.com

Verify

Your brand-new public key is now stored at ~/.ssh/id_rsa.pub

~ is the home directory for the current user. That's you!

Public vs. Private Keys

If you look inside ~/.ssh/, you will notice two files with the same name: id_rsa and id_rsa.pub.

id_rsa.pub is your public key and can be shared freely.

id_rsa is your private key and must be kept secret.

If someone else gets your private key and your passphrase, then they can pretend to be you and log on to your Heroku or Github accounts and cause mischief!

Add your generated public key to the authentication agent using the following command:

Type this in the terminal:
ssh-add ~/.ssh/id_rsa
Expected result:
Enter passphrase for /Users/student/.ssh/id_rsa:
Identity added: /Users/student/.ssh/id_rsa (/Users/student/.ssh/id_rsa)"

Next Step:

Back to Configure Git

If you find something that could be improved, please make a pull request or drop us a note via GitHub Issues (no technical knowledge required).

Source: https://github.com/RailsBridge-CapeTown