Generate a New SSH Key for GitHub (Linux)

Linux - Generate a New SSH Key for GitHub

Step 01 List All SSH Files

List All SSH Files

List all SSH files to double check and make sure not to overwrite any existing SSH keys.

Step 02 Go into Directory

Go into Directory

Point your command line terminal to the right folder so we can generate a new SSH private key for your GitHub account.

Step 03 Generate a SSH Private Key

Generate a SSH Private Key

Use SSH generator to generate a key and attach it to your existing email address with the one on your GitHub account. (Make sure to replace [email protected] with your GitHub account's email)

Step 04 Go Through the Generator Sequence

Go Through the Generator Sequence

While going through the generator sequence you can leave passphrase blank (if on your personal machine) or for more security fill in a passphase on a work shared machine. For tutorial purposes chose the file name github_rsa. It'll be easier to follow along other GitHub tutorials.

Step 05 Make Sure SSH Agent is On

Make Sure SSH Agent is On

Turn on SSH agent in the background with the following command.

Step 06 Add your GitHub Private Key

Add your GitHub Private Key

Add your SSH private key to the ssh-agent that you just previously turned on in the last step.

Step 07 Copy Your Private Key Add to GitHub

Copy Your Private Key Add to GitHub

Add your private key to GitHub account.

Step 08 SSH GitHub Test

SSH GitHub Test

Test to see if all previous steps are successful with the following command.