SSH Key Authentication

Another way to authenticate with GitHub is via an SSH key. The key is generated on your local machine and installed on GitHub. It has all the permissions of your regular account and is the typical way remote servers are accessed. The rest of this guide will show how to generate and set up an SSH key and use it with GitHub.

Note If you use 1Password, then there is even an easier way to generate and install an SSH key at GitHub and to install an SSH Signing Key at GitHub. If you use 1Password Business at work, you are eligible for a [free, separate 1Password Families membership](

Generating an SSH Key

  1. Create an SSH key:

    If you are on Ubuntu and the above command fails, you may have to install the ssh package:

    The command asks you for the file to save the key during the command. The default is fine. It also asks you for a passphrase. You can leave this blank for now.

    This command creates an ed25519 SSH key with 100 rounds for increased resistance to brute-force cracking.

  2. You have generated a public/private key pair. The public key is in the file For example:

    ed25519 keys are very secure, but the public key is concise (1 line) compared to other key types. The one-line is easier to post and use.

    It is safe and common to share the public key.

    The private key is in the file ed25519. Do not share your private key

Installing an SSH Key at GitHub

  1. Go to your account at GitHub under Settings/SSH and GPG Keys
  2. Click the New SSH Key button
  3. Enter a Title (anything you want)
  4. In the Key box, enter your public key. This is the contents of the file ~/.ssh/ Do not enter your private key.
  5. Click the button Add SSH Key.
  6. To verify if you have correctly added your key to GitHub, enter the following command:

    The response should include the phrase "You've successfully authenticated, but GitHub does not provide shell access."

Using SSH Key with GitHub

Now when you clone a repository, you can use the SSH version, e.g.,

SSH Keys for Logins

If you have remote systems with accounts, you can ssh to them using your SSH key. E.g., for use the command:

This will ask for your username/password login and install your public SSH key on your account at the server. From now on, it will not ask you for a username/password to log in from your local computer.

On Ubuntu, to get this command, you may have to install a package: