1
0
mirror of synced 2025-12-22 19:34:15 -05:00
Files
docs/content/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account.md
Vanessa Yuen 3df90fc9b8 Hello git history spelunker!
Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
2020-09-27 14:10:11 +02:00

5.0 KiB

title, intro, redirect_from, versions
title intro redirect_from versions
Adding a new SSH key to your GitHub account To configure your {{ site.data.variables.product.product_name }} account to use your new (or existing) SSH key, you'll also need to add it to your {{ site.data.variables.product.product_name }} account.
/articles/adding-a-new-ssh-key-to-your-github-account
free-pro-team enterprise-server
* *

Before adding a new SSH key to your {{ site.data.variables.product.product_name }} account, you should have:

After adding a new SSH key to your {{ site.data.variables.product.product_name }} account, you can reconfigure any local repositories to use SSH. For more information, see "Switching remote URLs from HTTPS to SSH."

{{ site.data.reusables.ssh.dsa-support }}

{% mac %}

  1. Copy the SSH key to your clipboard.

If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.

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

{% tip %}

Tip: If pbcopy isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

{% endtip %}

{{ site.data.reusables.user_settings.access_settings }} {{ site.data.reusables.user_settings.ssh }} 4. Click New SSH key or Add SSH key. SSH Key button 5. 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". 6. Paste your key into the "Key" field. The key field 7. Click Add SSH key. The Add key button {{ site.data.reusables.user_settings.sudo-mode-popup }}

{% endmac %}

{% windows %}

  1. Copy the SSH key to your clipboard.

If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.

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

{% tip %}

Tip: If clip isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

{% endtip %}

{{ site.data.reusables.user_settings.access_settings }} {{ site.data.reusables.user_settings.ssh }} 4. Click New SSH key or Add SSH key. SSH Key button 5. 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". 6. Paste your key into the "Key" field. The key field 7. Click Add SSH key. The Add key button 8. If prompted, confirm your {{ site.data.variables.product.product_name }} password. Sudo mode dialog

{% endwindows %}

{% linux %}

  1. Copy the SSH key to your clipboard.

If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.

$ sudo apt-get install xclip
# Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)

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

{% tip %}

Tip: If xclip isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

{% endtip %}

{{ site.data.reusables.user_settings.access_settings }} {{ site.data.reusables.user_settings.ssh }} 4. Click New SSH key or Add SSH key. SSH Key button 5. 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". 6. Paste your key into the "Key" field. The key field 7. Click Add SSH key. The Add key button 8. If prompted, confirm your {{ site.data.variables.product.product_name }} password. Sudo mode dialog

{% endlinux %}

{% if currentVersion == "free-pro-team@latest" %}

Further reading