Press enter to accept the default key save location.
Next, you'll be asked for a passphrase.
Choose whether to use a passphrase
Hit enter to accept blank passphrase, then hit enter again.
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.
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 [email protected]
Your brand-new public key is now stored at ~/.ssh/id_rsa.pub
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 key to the authentication agent using the following command:
Type this in the terminal:
Enter passphrase for /Users/student/.ssh/id_rsa:
Identity added: /Users/student/.ssh/id_rsa (/Users/student/.ssh/id_rsa)"
Could not open a connection to your authentication agent
If the ssh-agent is not running, you will come across this error. Here are a few commands that you can try to use to start the ssh-agent:
For some Windows machines:
eval `ssh-agent -s`
For others (confirmed on some Windows 7, 8, 8.1, and 10 setups):