SSH Key Authentication

Using an SSH key is an alternative method to authenticate with GitHub. This key, generated on your local machine and then added to GitHub, grants permissions equivalent to your regular account. This guide will walk you through generating, setting up, and using an SSH key with GitHub.

Tip: If you're a 1Password user, there's a streamlined process to generate and add an SSH key to GitHub and to install an SSH Signing Key at GitHub. Additionally, 1Password Business users can get a complimentary 1Password Families membership.

Before we begin, verify that you have the ssh command available on your command line:

If you are on Ubuntu, you might need to install the ssh package:

Create the SSH Key

The command generates an ed25519 SSH key with enhanced brute-force resistance.

During the key generation, you'll be prompted to specify a file to save the key (the default is recommended) and to set a passphrase (which can be left blank for now). The output will follow this general pattern:

Locate Your SSH Key

You've now created a public/private key pair. The public key is stored in the file ~/.ssh/ed25519.pub where ~ is your $HOME directory:

If you need to get the key value, you can cat the file:

Ed25519 keys are secure and concise, making them easy to share and use. Always remember:

Installing an SSH Key on GitHub

  1. Navigate to your GitHub account's Settings/SSH and GPG Keys.
  2. Click on New SSH Key.
  3. Enter a descriptive title.
  4. In the Key field, paste the content of your public key (~/.ssh/ed25519.pub). Ensure you never use your private key here.
  5. Confirm by clicking Add SSH Key.
  6. To ensure your key was added successfully, run the following:

A successful response will mention: "You've successfully authenticated, but GitHub does not provide shell access."

Using Your SSH Key with GitHub

When cloning a repository, opt for the SSH version:

SSH Keys for Remote Logins

For remote system access, such as knuth2.cs.uakron.edu, use:

Upon first use, you'll be prompted for your username and password. Post this, your public SSH key will be added, allowing password-free access from your local machine.