ran script/content-migrations/remove-map-topics.js && script/content-migrations/update-tocs.js
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: About SSH
|
||||
intro: 'Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to {% data variables.product.product_name %} without supplying your username and personal access token at each visit.'
|
||||
redirect_from:
|
||||
- /articles/about-ssh
|
||||
- /github/authenticating-to-github/about-ssh
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
topics:
|
||||
- SSH
|
||||
---
|
||||
When you set up SSH, you will need to generate a new SSH key and add it to the ssh-agent. You must add the SSH key to your account on {% data variables.product.product_name %} before you use the key to authenticate. For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)" and "[Adding a new SSH key to your {% data variables.product.prodname_dotcom %} account](/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account)."
|
||||
|
||||
You can further secure your SSH key by using a hardware security key, which requires the physical hardware security key to be attached to your computer when the key pair is used to authenticate with SSH. You can also secure your SSH key by adding your key to the ssh-agent and using a passphrase. For more information, see "[Working with SSH key passphrases](/github/authenticating-to-github/working-with-ssh-key-passphrases)."
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}To use your SSH key with a repository owned by an organization that uses SAML single sign-on, you must authorize the key. For more information, see "[Authorizing an SSH key for use with SAML single sign-on](/articles/authorizing-an-ssh-key-for-use-with-saml-single-sign-on)."{% endif %}
|
||||
|
||||
To maintain account security, you can regularly review your SSH keys list and revoke any keys that are invalid or have been compromised. For more information, see "[Reviewing your SSH keys](/github/authenticating-to-github/reviewing-your-ssh-keys)."
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
If you haven't used your SSH key for a year, then {% data variables.product.prodname_dotcom %} will automatically delete your inactive SSH key as a security precaution. For more information, see "[Deleted or missing SSH keys](/articles/deleted-or-missing-ssh-keys)."
|
||||
{% endif %}
|
||||
|
||||
If you're a member of an organization that provides SSH certificates, you can use your certificate to access that organization's repositories without adding the certificate to your {% data variables.product.product_name %} account. For more information, see "[About SSH certificate authorities](/articles/about-ssh-certificate-authorities)."
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Checking for existing SSH keys](/articles/checking-for-existing-ssh-keys)"
|
||||
- "[Testing your SSH connection](/articles/testing-your-ssh-connection)"
|
||||
- "[Troubleshooting SSH](/articles/troubleshooting-ssh)"
|
||||
@@ -0,0 +1,129 @@
|
||||
---
|
||||
title: Adding a new SSH key to your GitHub account
|
||||
intro: '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.'
|
||||
redirect_from:
|
||||
- /articles/adding-a-new-ssh-key-to-your-github-account
|
||||
- /github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
topics:
|
||||
- SSH
|
||||
---
|
||||
Before adding a new SSH key to your {% data variables.product.product_name %} account, you should have:
|
||||
* [Checked for existing SSH keys](/articles/checking-for-existing-ssh-keys)
|
||||
* [Generated a new SSH key and added it to the ssh-agent](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
|
||||
|
||||
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](/github/getting-started-with-github/managing-remote-repositories/#switching-remote-urls-from-https-to-ssh)."
|
||||
|
||||
{% data reusables.ssh.dsa-support %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@latest" or currentVersion ver_gt "enterprise-server@2.19" %}
|
||||
{% tip %}
|
||||
|
||||
**Tip**: You can also add an SSH key using the {% data variables.product.prodname_cli %}. For more information, see "[`gh ssh-key add`](https://cli.github.com/manual/gh_ssh-key_add)" in the {% data variables.product.prodname_cli %} documentation.
|
||||
|
||||
{% endtip %}
|
||||
{% endif %}
|
||||
|
||||
{% 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.
|
||||
|
||||
```shell
|
||||
$ pbcopy < ~/.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**.
|
||||

|
||||
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.
|
||||

|
||||
7. Click **Add SSH key**.
|
||||

|
||||
{% 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.
|
||||
|
||||
```shell
|
||||
$ clip < ~/.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**.
|
||||

|
||||
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.
|
||||

|
||||
7. Click **Add SSH key**.
|
||||

|
||||
8. If prompted, confirm your {% data variables.product.product_name %} password.
|
||||

|
||||
|
||||
{% 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.
|
||||
|
||||
```shell
|
||||
$ sudo apt-get update
|
||||
$ 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 < ~/.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**.
|
||||

|
||||
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.
|
||||

|
||||
7. Click **Add SSH key**.
|
||||

|
||||
8. If prompted, confirm your {% data variables.product.product_name %} password.
|
||||

|
||||
|
||||
{% endlinux %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
### Further reading
|
||||
|
||||
- "[Authorizing an SSH key for use with SAML single sign-on](/articles/authorizing-an-ssh-key-for-use-with-saml-single-sign-on)"
|
||||
{% endif %}
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: Checking for existing SSH keys
|
||||
intro: 'Before you generate an SSH key, you can check to see if you have any existing SSH keys.'
|
||||
redirect_from:
|
||||
- /articles/checking-for-existing-ssh-keys
|
||||
- /github/authenticating-to-github/checking-for-existing-ssh-keys
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
topics:
|
||||
- SSH
|
||||
---
|
||||
{% data reusables.ssh.dsa-support %}
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Enter `ls -al ~/.ssh` to see if existing SSH keys are present:
|
||||
|
||||
```shell
|
||||
$ ls -al ~/.ssh
|
||||
# Lists the files in your .ssh directory, if they exist
|
||||
```
|
||||
3. Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following:
|
||||
- *id_rsa.pub*
|
||||
- *id_ecdsa.pub*
|
||||
- *id_ed25519.pub*
|
||||
|
||||
If you don't have an existing public and private key pair, or don't wish to use any that are available to connect to {% data variables.product.product_name %}, then [generate a new SSH key](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
|
||||
|
||||
If you see an existing public and private key pair listed (for example *id_rsa.pub* and *id_rsa*) that you would like to use to connect to {% data variables.product.product_name %}, you can [add your SSH key to the ssh-agent](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#adding-your-ssh-key-to-the-ssh-agent).
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip:** If you receive an error that *~/.ssh* doesn't exist, don't worry! We'll create it when we [generate a new SSH key](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
|
||||
|
||||
{% endtip %}
|
||||
@@ -0,0 +1,249 @@
|
||||
---
|
||||
title: Generating a new SSH key and adding it to the ssh-agent
|
||||
intro: 'After you''ve checked for existing SSH keys, you can generate a new SSH key to use for authentication, then add it to the ssh-agent.'
|
||||
redirect_from:
|
||||
- /articles/adding-a-new-ssh-key-to-the-ssh-agent/
|
||||
- /articles/generating-a-new-ssh-key/
|
||||
- /articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
|
||||
- /github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
topics:
|
||||
- SSH
|
||||
---
|
||||
### About SSH key generation
|
||||
|
||||
If you don't already have an SSH key, you must generate a new SSH key to use for authentication. If you're unsure whether you already have an SSH key, you can check for existing keys. For more information, see "[Checking for existing SSH keys](/github/authenticating-to-github/checking-for-existing-ssh-keys)."
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
|
||||
If you want to use a hardware security key to authenticate to {% data variables.product.product_name %}, you must generate a new SSH key for your hardware security key. You must connect your hardware security key to your computer when you authenticate with the key pair. For more information, see the [OpenSSH 8.2 release notes](https://www.openssh.com/txt/release-8.2).
|
||||
|
||||
{% endif %}
|
||||
If you don't want to reenter your passphrase every time you use your SSH key, you can add your key to the SSH agent, which manages your SSH keys and remembers your passphrase.
|
||||
|
||||
### Generating a new SSH key
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Paste the text below, substituting in your {% data variables.product.product_name %} email address.
|
||||
```shell
|
||||
$ ssh-keygen -t ed25519 -C "<em>your_email@example.com</em>"
|
||||
```
|
||||
{% note %}
|
||||
|
||||
**Note:** If you are using a legacy system that doesn't support the Ed25519 algorithm, use:
|
||||
```shell
|
||||
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
|
||||
```
|
||||
|
||||
{% endnote %}
|
||||
This creates a new ssh key, using the provided email as a label.
|
||||
```shell
|
||||
> Generating public/private ed25519 key pair.
|
||||
```
|
||||
3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
|
||||
|
||||
{% mac %}
|
||||
|
||||
```shell
|
||||
> Enter a file in which to save the key (/Users/<em>you</em>/.ssh/id_ed25519): <em>[Press enter]</em>
|
||||
```
|
||||
|
||||
{% endmac %}
|
||||
|
||||
{% windows %}
|
||||
|
||||
```shell
|
||||
> Enter a file in which to save the key (/c/Users/<em>you</em>/.ssh/id_ed25519):<em>[Press enter]</em>
|
||||
```
|
||||
|
||||
{% endwindows %}
|
||||
|
||||
{% linux %}
|
||||
|
||||
```shell
|
||||
> Enter a file in which to save the key (/home/<em>you</em>/.ssh/id_ed25519): <em>[Press enter]</em>
|
||||
```
|
||||
|
||||
{% endlinux %}
|
||||
|
||||
4. At the prompt, type a secure passphrase. For more information, see ["Working with SSH key passphrases](/articles/working-with-ssh-key-passphrases)."
|
||||
```shell
|
||||
> Enter passphrase (empty for no passphrase): <em>[Type a passphrase]</em>
|
||||
> Enter same passphrase again: <em>[Type passphrase again]</em>
|
||||
```
|
||||
|
||||
### Adding your SSH key to the ssh-agent
|
||||
|
||||
Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key. <span class="platform-mac">When adding your SSH key to the agent, use the default macOS `ssh-add` command, and not an application installed by [macports](https://www.macports.org/), [homebrew](http://brew.sh/), or some other external source.</span>
|
||||
|
||||
{% mac %}
|
||||
|
||||
1. {% data reusables.command_line.start_ssh_agent %}
|
||||
|
||||
2. If you're using macOS Sierra 10.12.2 or later, you will need to modify your `~/.ssh/config` file to automatically load keys into the ssh-agent and store passphrases in your keychain.
|
||||
|
||||
* First, check to see if your `~/.ssh/config` file exists in the default location.
|
||||
|
||||
```shell
|
||||
$ open ~/.ssh/config
|
||||
> The file /Users/<em>you</em>/.ssh/config does not exist.
|
||||
```
|
||||
|
||||
* If the file doesn't exist, create the file.
|
||||
|
||||
```shell
|
||||
$ touch ~/.ssh/config
|
||||
```
|
||||
|
||||
* Open your `~/.ssh/config` file, then modify the file to contain the following lines. If your SSH key file has a different name or path than the example code, modify the filename or path to match your current setup.
|
||||
|
||||
```
|
||||
Host *
|
||||
AddKeysToAgent yes
|
||||
UseKeychain yes
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
```
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** If you chose not to add a passphrase to your key, you should omit the `UseKeychain` line.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% mac %}
|
||||
{% note %}
|
||||
|
||||
**Note:** If you see an error like this
|
||||
|
||||
```
|
||||
/Users/USER/.ssh/config: line 16: Bad configuration option: usekeychain
|
||||
```
|
||||
|
||||
add an additional config line to your `Host *` section:
|
||||
|
||||
```
|
||||
Host *
|
||||
IgnoreUnknown UseKeychain
|
||||
```
|
||||
|
||||
{% endnote %}
|
||||
{% endmac %}
|
||||
|
||||
3. Add your SSH private key to the ssh-agent and store your passphrase in the keychain. {% data reusables.ssh.add-ssh-key-to-ssh-agent %}
|
||||
```shell
|
||||
$ ssh-add -K ~/.ssh/id_ed25519
|
||||
```
|
||||
{% note %}
|
||||
|
||||
**Note:** The `-K` option is Apple's standard version of `ssh-add`, which stores the passphrase in your keychain for you when you add an ssh key to the ssh-agent. If you chose not to add a passphrase to your key, run the command without the `-K` option.
|
||||
|
||||
If you don't have Apple's standard version installed, you may receive an error. For more information on resolving this error, see "[Error: ssh-add: illegal option -- K](/articles/error-ssh-add-illegal-option-k)."
|
||||
|
||||
{% endnote %}
|
||||
|
||||
4. Add the SSH key to your account on {% data variables.product.product_name %}. For more information, see "[Adding a new SSH key to your {% data variables.product.prodname_dotcom %} account](/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account)."
|
||||
|
||||
{% endmac %}
|
||||
|
||||
{% windows %}
|
||||
|
||||
{% data reusables.desktop.windows_git_bash %}
|
||||
|
||||
1. Ensure the ssh-agent is running. You can use the "Auto-launching the ssh-agent" instructions in "[Working with SSH key passphrases](/articles/working-with-ssh-key-passphrases)", or start it manually:
|
||||
```shell
|
||||
# start the ssh-agent in the background
|
||||
$ eval `ssh-agent -s`
|
||||
> Agent pid 59566
|
||||
```
|
||||
|
||||
2. Add your SSH private key to the ssh-agent. {% data reusables.ssh.add-ssh-key-to-ssh-agent %}
|
||||
{% data reusables.ssh.add-ssh-key-to-ssh-agent-commandline %}
|
||||
|
||||
3. Add the SSH key to your account on {% data variables.product.product_name %}. For more information, see "[Adding a new SSH key to your {% data variables.product.prodname_dotcom %} account](/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account)."
|
||||
|
||||
{% endwindows %}
|
||||
|
||||
{% linux %}
|
||||
|
||||
1. {% data reusables.command_line.start_ssh_agent %}
|
||||
|
||||
In some Linux environments, you need root access to run the command:
|
||||
|
||||
```
|
||||
$ sudo -s -H
|
||||
$ eval "$(ssh-agent -s)"
|
||||
> Agent pid 59566
|
||||
```
|
||||
|
||||
2. Add your SSH private key to the ssh-agent. {% data reusables.ssh.add-ssh-key-to-ssh-agent %}
|
||||
{% data reusables.ssh.add-ssh-key-to-ssh-agent-commandline %}
|
||||
|
||||
3. Add the SSH key to your account on {% data variables.product.product_name %}. For more information, see "[Adding a new SSH key to your {% data variables.product.prodname_dotcom %} account](/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account)."
|
||||
|
||||
{% endlinux %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@next" or currentVersion ver_gt "enterprise-server@3.1" %}
|
||||
### Generating a new SSH key for a hardware security key
|
||||
|
||||
If you are using macOS or Linux, you may need to update your SSH client or install a new SSH client prior to generating a new SSH key. For more information, see "[Error: Unknown key type](/github/authenticating-to-github/error-unknown-key-type)."
|
||||
|
||||
1. Insert your hardware security key into your computer.
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
3. Paste the text below, substituting in the email address for your account on {% data variables.product.product_name %}.
|
||||
```shell
|
||||
$ ssh-keygen -t ed25519-sk -C "<em>your_email@example.com</em>"
|
||||
```
|
||||
{% note %}
|
||||
|
||||
**Note:** If the command fails and you receive the error `invalid format` or `feature not supported,` you may be using a hardware security key that does not support the Ed25519 algorithm. Enter the following command instead.
|
||||
```shell
|
||||
$ ssh-keygen -t ecdsa-sk -C "your_email@example.com"
|
||||
```
|
||||
|
||||
{% endnote %}
|
||||
4. When you are prompted, touch the button on your hardware security key.
|
||||
5. When you are prompted to "Enter a file in which to save the key," press Enter to accept the default file location.
|
||||
|
||||
{% mac %}
|
||||
|
||||
```shell
|
||||
> Enter a file in which to save the key (/Users/<em>you</em>/.ssh/id_ed25519_sk): <em>[Press enter]</em>
|
||||
```
|
||||
|
||||
{% endmac %}
|
||||
|
||||
{% windows %}
|
||||
|
||||
```shell
|
||||
> Enter a file in which to save the key (/c/Users/<em>you</em>/.ssh/id_ed25519_sk):<em>[Press enter]</em>
|
||||
```
|
||||
|
||||
{% endwindows %}
|
||||
|
||||
{% linux %}
|
||||
|
||||
```shell
|
||||
> Enter a file in which to save the key (/home/<em>you</em>/.ssh/id_ed25519_sk): <em>[Press enter]</em>
|
||||
```
|
||||
|
||||
{% endlinux %}
|
||||
|
||||
6. When you are prompted to type a passphrase, press **Enter**.
|
||||
```shell
|
||||
> Enter passphrase (empty for no passphrase): <em>[Type a passphrase]</em>
|
||||
> Enter same passphrase again: <em>[Type passphrase again]</em>
|
||||
```
|
||||
7. Add the SSH key to your account on {% data variables.product.prodname_dotcom %}. For more information, see "[Adding a new SSH key to your {% data variables.product.prodname_dotcom %} account](/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[About SSH](/articles/about-ssh)"
|
||||
- "[Working with SSH key passphrases](/articles/working-with-ssh-key-passphrases)"
|
||||
{%- if currentVersion == "free-pro-team@latest" %}
|
||||
- "[Authorizing an SSH key for use with SAML single sign-on](/articles/authorizing-an-ssh-key-for-use-with-saml-single-sign-on)"
|
||||
{%- endif %}
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Connecting to GitHub with SSH
|
||||
intro: 'You can connect to {% data variables.product.product_name %} using SSH.'
|
||||
redirect_from:
|
||||
- /key-setup-redirect/
|
||||
- /linux-key-setup/
|
||||
- /mac-key-setup/
|
||||
- /msysgit-key-setup/
|
||||
- /articles/ssh-key-setup/
|
||||
- /articles/generating-ssh-keys/
|
||||
- /articles/generating-an-ssh-key/
|
||||
- /articles/connecting-to-github-with-ssh
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
topics:
|
||||
- SSH
|
||||
children:
|
||||
- /about-ssh
|
||||
- /checking-for-existing-ssh-keys
|
||||
- /generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
|
||||
- /adding-a-new-ssh-key-to-your-github-account
|
||||
- /testing-your-ssh-connection
|
||||
- /working-with-ssh-key-passphrases
|
||||
---
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title: Testing your SSH connection
|
||||
intro: 'After you''ve set up your SSH key and added it to your {% data variables.product.product_name %} account, you can test your connection.'
|
||||
redirect_from:
|
||||
- /articles/testing-your-ssh-connection
|
||||
- /github/authenticating-to-github/testing-your-ssh-connection
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
topics:
|
||||
- SSH
|
||||
---
|
||||
Before testing your SSH connection, you should have:
|
||||
- [Checked for existing SSH keys](/articles/checking-for-existing-ssh-keys)
|
||||
- [Generated a new SSH key](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
|
||||
- [Added a new SSH key to your GitHub account](/articles/adding-a-new-ssh-key-to-your-github-account)
|
||||
|
||||
When you test your connection, you'll need to authenticate this action using your password, which is the SSH key passphrase you created earlier. For more information on working with SSH key passphrases, see ["Working with SSH key passphrases"](/articles/working-with-ssh-key-passphrases).
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Enter the following:
|
||||
```shell
|
||||
$ ssh -T git@{% data variables.command_line.codeblock %}
|
||||
# Attempts to ssh to {% data variables.product.product_name %}
|
||||
```
|
||||
|
||||
You may see a warning like this:
|
||||
|
||||
```shell
|
||||
> The authenticity of host '{% data variables.command_line.codeblock %} (IP ADDRESS)' can't be established.
|
||||
> RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
|
||||
> Are you sure you want to continue connecting (yes/no)?
|
||||
```
|
||||
|
||||
3. Verify that the fingerprint in the message you see matches {% if currentVersion == "free-pro-team@latest" %}[{% data variables.product.prodname_dotcom %}'s RSA public key fingerprint](/github/authenticating-to-github/githubs-ssh-key-fingerprints){% else %} your enterprise's public key fingerprint{% endif %}. If it does, then type `yes`:
|
||||
```shell
|
||||
> Hi <em>username</em>! You've successfully authenticated, but GitHub does not
|
||||
> provide shell access.
|
||||
```
|
||||
|
||||
{% linux %}
|
||||
|
||||
You may see this error message:
|
||||
```shell
|
||||
...
|
||||
Agent admitted failure to sign using the key.
|
||||
debug1: No more authentication methods to try.
|
||||
Permission denied (publickey).
|
||||
```
|
||||
|
||||
This is a known problem with certain Linux distributions. For more information, see ["Error: Agent admitted failure to sign"](/articles/error-agent-admitted-failure-to-sign).
|
||||
|
||||
{% endlinux %}
|
||||
|
||||
4. Verify that the resulting message contains your username. If you receive a "permission denied" message, see ["Error: Permission denied (publickey)"](/articles/error-permission-denied-publickey).
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
title: Working with SSH key passphrases
|
||||
intro: You can secure your SSH keys and configure an authentication agent so that you won't have to reenter your passphrase every time you use your SSH keys.
|
||||
redirect_from:
|
||||
- /ssh-key-passphrases/
|
||||
- /working-with-key-passphrases/
|
||||
- /articles/working-with-ssh-key-passphrases
|
||||
- /github/authenticating-to-github/working-with-ssh-key-passphrases
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
topics:
|
||||
- SSH
|
||||
---
|
||||
With SSH keys, if someone gains access to your computer, they also gain access to every system that uses that key. To add an extra layer of security, you can add a passphrase to your SSH key. You can use `ssh-agent` to securely save your passphrase so you don't have to reenter it.
|
||||
|
||||
### Adding or changing a passphrase
|
||||
|
||||
You can change the passphrase for an existing private key without regenerating the keypair by typing the following command:
|
||||
|
||||
```shell
|
||||
$ ssh-keygen -p -f ~/.ssh/id_ed25519
|
||||
> Enter old passphrase: <em>[Type old passphrase]</em>
|
||||
> Key has comment '<em>your_email@example.com</em>'
|
||||
> Enter new passphrase (empty for no passphrase): <em>[Type new passphrase]</em>
|
||||
> Enter same passphrase again: <em>[Repeat the new passphrase]</em>
|
||||
> Your identification has been saved with the new passphrase.
|
||||
```
|
||||
|
||||
If your key already has a passphrase, you will be prompted to enter it before you can change to a new passphrase.
|
||||
|
||||
{% windows %}
|
||||
|
||||
### Auto-launching `ssh-agent` on Git for Windows
|
||||
|
||||
You can run `ssh-agent` automatically when you open bash or Git shell. Copy the following lines and paste them into your `~/.profile` or `~/.bashrc` file in Git shell:
|
||||
|
||||
``` bash
|
||||
env=~/.ssh/agent.env
|
||||
|
||||
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
|
||||
|
||||
agent_start () {
|
||||
(umask 077; ssh-agent >| "$env")
|
||||
. "$env" >| /dev/null ; }
|
||||
|
||||
agent_load_env
|
||||
|
||||
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
|
||||
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
|
||||
|
||||
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
|
||||
agent_start
|
||||
ssh-add
|
||||
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
|
||||
ssh-add
|
||||
fi
|
||||
|
||||
unset env
|
||||
```
|
||||
|
||||
If your private key is not stored in one of the default locations (like `~/.ssh/id_rsa`), you'll need to tell your SSH authentication agent where to find it. To add your key to ssh-agent, type `ssh-add ~/path/to/my_key`. For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/)"
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip:** If you want `ssh-agent` to forget your key after some time, you can configure it to do so by running `ssh-add -t <seconds>`.
|
||||
|
||||
{% endtip %}
|
||||
|
||||
Now, when you first run Git Bash, you are prompted for your passphrase:
|
||||
|
||||
```shell
|
||||
> Initializing new SSH agent...
|
||||
> succeeded
|
||||
> Enter passphrase for /c/Users/<em>you</em>/.ssh/id_rsa:
|
||||
> Identity added: /c/Users/<em>you</em>/.ssh/id_rsa (/c/Users/<em>you</em>/.ssh/id_rsa)
|
||||
> Welcome to Git (version <em>1.6.0.2-preview20080923</em>)
|
||||
>
|
||||
> Run 'git help git' to display the help index.
|
||||
> Run 'git help <command>' to display help for specific commands.
|
||||
```
|
||||
|
||||
The `ssh-agent` process will continue to run until you log out, shut down your computer, or kill the process.
|
||||
|
||||
{% endwindows %}
|
||||
|
||||
{% mac %}
|
||||
|
||||
### Saving your passphrase in the keychain
|
||||
|
||||
On Mac OS X Leopard through OS X El Capitan, these default private key files are handled automatically:
|
||||
|
||||
- *.ssh/id_rsa*
|
||||
- *.ssh/identity*
|
||||
|
||||
The first time you use your key, you will be prompted to enter your passphrase. If you choose to save the passphrase with your keychain, you won't have to enter it again.
|
||||
|
||||
Otherwise, you can store your passphrase in the keychain when you add your key to the ssh-agent. For more information, see "[Adding your SSH key to the ssh-agent](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent)."
|
||||
|
||||
{% endmac %}
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[About SSH](/articles/about-ssh)"
|
||||
Reference in New Issue
Block a user