---
title: "How to Add SSH Keys to Your GitHub Account"
description: "GitHub offers a convenient SSH key feature for accessing your repositories on the command line. Instead of using usernames and passwords every time you push to or pull from your repository, you can..."
url: https://www.inmotionhosting.com/support/server/ssh/how-to-add-ssh-keys-to-your-github-account/
date: 2018-02-08
modified: 2025-02-05
author: "Jesse Owens"
categories: ["SSH and Root Access"]
type: post
lang: en
---

# How to Add SSH Keys to Your GitHub Account

![How to Add SSH Keys to Your GitHub Account](https://www.inmotionhosting.com/support/wp-content/uploads/2022/02/How-to-Add-SSH-Keys-to-Your-GitHub-Account-1024x538.png)

GitHub offers a convenient SSH key feature for accessing your repositories on the command line. Instead of using usernames and passwords every time you push to or pull from your repository, you can use your key. In this article we’ll learn **how to add SSH keys to your GitHub account**.

## Why use an SSH key?

Using an SSH key is a convenient and secure way to access your account. It’s convenient because you don’t need to remember a long password. And you can make your actual password so brutally long and secure that no human or bot could guess it. The SSH key works like an actual key that only you possess.

## How to Create an SSH Key

In order to use an SSH key with Git, you must first create the key on your computer. **If you already have an SSH key, you can skip these steps.** In order to check if you have a key, you can run this command:

user@server# ssh-add -l

Follow along with the steps below to create the key and copy its contents. You will need to open your computer’s default terminal application.

1. Open the terminal app on your computer.
2. Enter the following command, substituting joe@example.com with your email address: user@server# ssh-keygen -t rsa -b 4096 -C "joe@example.com"
3. Press **Enter** to accept the default file location.
4. Enter a [secure passphrase](/support/server/ssh/how-to-create-a-strong-passphrase-for-ssh/).
5. Press **Enter**.
6. Enter this command to display the contents of your public key: user@server# cat .ssh/id_rsa.pub
7. Copy the contents of your key to your clipboard (we will need it later).

It’s important to remember that the SSH key has two parts: a private key and a public key. As the name suggests, the private key is only for private use. **Never ever share your private key with anyone** (with exceptions made for your system administrator or other trusted people within your organization). This will be important later.

## How to Add an SSH Key to your Github Account

Now we have already seen why you might want to use an SSH key. We also demonstrated how to create an SSH key on your computer.

As mentioned above, we have a private key and a public key. In the steps below you’ll learn how to upload your public key to GitHub.

1. [Log into your GitHub account](/support/website/git/using-your-github-account/).
2. Click your avatar and choose **Settings**.![screenshot showing the user preferences menu highlighting the settings option](https://www.inmotionhosting.com/support/wp-content/uploads/2018/02/github-settings.png) 
3. Select **SSH and GPG keys**.
4. Click **New SSH key**.![screenshot of the github settings menu with SSH and GPG keys highlighted and the new SSH key button highlighted](https://www.inmotionhosting.com/support/wp-content/uploads/2018/02/ssh-and-gpg-keys.png)  
5. Enter a title in the field.
6. Paste your public key into the *Key* field.
7. Click **Add SSH key**.

## Next Steps

Well done! You now know how to add SSH keys to your GitHub account. Make sure to check out some of our other Git articles:

- [Introduction to Git](/support/git/)
- [Using Git to Publish Files](/support/website/git/using-git-to-publish-files/)
- [How to Use Tags in Git](/support/website/git/how-to-use-tags-in-git/)

Looking for a [dedicated server](https://www.inmotionhosting.com/dedicated-servers)? We’ve got you covered.
