1
0
mirror of synced 2025-12-26 14:02:45 -05:00
Files
docs/content/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account.md
Emily Gould 5a20716c7e Restructure and move Git content (#18336)
* Rename map topic

* Delete map topic

* Rename map topic

* Add redirect

* Remove last two map topics

* Move article on adding a remote into a long-form guide

* Move article on changing a remote's URL

* Move articles on renaming and removing remotes

* Move remote URL article

* Fix typo

* Remove category index file

* Move a few articles to the new category

* Move a few more files

* Move managing remote repos article

* Move the rest of the getting started with git map topic

* Move the first half of the using git map topic

* Move the rest of the articles and 🔥 the directory

* Fix failing test

* Remove Using Git from product index

* Apply suggestions from code review

Co-authored-by: Laura Coursen <lecoursen@github.com>

* Apply suggestions from code review

Co-authored-by: Laura Coursen <lecoursen@github.com>
2021-03-25 14:42:36 -05:00

5.1 KiB

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

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

After adding a new SSH key to your {% 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."

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

{% mac %}

  1. Copy the SSH public key to your clipboard.

If your SSH public 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 &lt; ~/.ssh/id_ed25519.pub
# Copies the contents of the id_ed25519.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 %}

{% data reusables.user_settings.access_settings %} {% 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 {% data reusables.user_settings.sudo-mode-popup %}

{% endmac %}

{% windows %}

  1. Copy the SSH public key to your clipboard.

If your SSH public 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 &lt; ~/.ssh/id_ed25519.pub
# Copies the contents of the id_ed25519.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 %}

{% data reusables.user_settings.access_settings %} {% 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 {% data variables.product.product_name %} password. Sudo mode dialog

{% endwindows %}

{% linux %}

  1. Copy the SSH public key to your clipboard.

If your SSH public 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 -selection clipboard &lt; ~/.ssh/id_ed25519.pub
# Copies the contents of the id_ed25519.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 %}

{% data reusables.user_settings.access_settings %} {% 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 {% data variables.product.product_name %} password. Sudo mode dialog

{% endlinux %}

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

Further reading