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:
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:
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:
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."
When cloning a repository, opt for the SSH version:
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.