To configure your GitHub account to use your SSH key:

Copy the SSH key to your clipboard. If your key is named id_dsa.pubid_ecdsa.pub orid_ed25519.pub, then change the filename below from id_rsa.pub to the one that matches your key:

clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

Warning: It's important to copy the key exactly without adding newlines or whitespace.

Add the copied key to GitHub:

  1. Settings icon in the user barIn the top right corner of any page, click your profile photo, then click Settings.

  2. SSH keysIn the user settings sidebar, click SSH keys.

  3. SSH Key buttonClick Add SSH key.

  4. In the Title field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air".
  5. The key fieldPaste your key into the "Key" field.
  6. The Add key buttonClick Add key.
  7. Confirm the action by entering your GitHub password.

Step 5: Test the connection

To make sure everything is working, you'll now try to SSH into GitHub. When you do this, you will be asked to authenticate this action using your password, which is the SSH key passphrase you created earlier.

  1. Open Git Bash and enter:

    ssh -T git@github.com
    # Attempts to ssh to GitHub
    
  2. You may see this warning:

    # The authenticity of host 'github.com (207.97.227.239)' can't be established.
    # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
    # Are you sure you want to continue connecting (yes/no)?
    

    Verify the fingerprint in the message you see matches the following message, then type yes:

    # Hi username! You've successfully authenticated, but GitHub does not
    # provide shell access.
    
  3. If the username in the message is yours, you've successfully set up your SSH key!

    If you receive a message about "access denied," you can read these instructions for diagnosing the issue.

    If you're switching from HTTPS to SSH, you'll now need to update your remote repository URLs. For more information, see Changing a remote's URL.