SSH

ssh

We recommend setting up an SSH key to simplify authentication with GitHub and other services.

Check for an existing key

In Hyper, make sure you’re in your home directory. You will be by default, but you can double-check with the “print working directory” command: pwd

WINGW64:/c/Users/user
 

pwd
/c/Users/dstrus

You should be in /c/Users/yourusername. If not, you can switch to that directory with the cd command, passing in the directory you want to switch to.

WINGW64:/c/Users/user
 
cd ~

~

You can always use a tilde ~ as a shortcut for your home directory.

Check for an .ssh directory:

WINGW64:/c/Users/user
 
ls .ssh

If you see an id_rsa.pub file, then you already have an SSH key and can skip to the next page.

Generate an SSH key

Type the following command to generate your SSH key, substituting the same email address you used for Git earlier:

WINGW64:/c/Users/user
 
ssh-keygen -t rsa -C "youremail@example.com"

It should prompt you for a file name. Hit ‘enter’ to accept the default.

It will then prompt you for a password. You can hit ‘enter’ (twice) to not set a passphrase. That compromises your key should anyone gain access to your laptop, but it may be simpler for the sake of this course. When you truly want to maximize security, it’s much safer to create a passphrase when generating a key.

If all is well, you should see that your identification and your public key have been saved to .ssh/id_rsa and .ssh/id_rsa.pub respectively.

You’ll test your new key shortly, but first you’ll need to create a GitHub account and add your public key to the account.