Docker-Docs/_includes/content/ssh/ssh-add-keys-to-agent.md

2.3 KiB

  • Mac
  • Windows
  • Linux

{% capture mac-content-add %} 1. Start the `ssh-agent` in the background using the command `eval "$(ssh-agent -s)"`. You get the agent process ID in return.
```none
eval "$(ssh-agent -s)"
Agent pid 59566
```
  1. On macOS Sierra 10.12.2 or newer, modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.

    Host *
     AddKeysToAgent yes
     UseKeychain yes
     IdentityFile ~/.ssh/id_rsa
    
  2. Add your SSH private key to the ssh-agent, using the default macOS ssh-add command.

    $ ssh-add -K ~/.ssh/id_rsa
    

    If you created your key with a different name or have an existing key with a different name, replace id_rsa in the command with the name of your private key file.

{% endcapture %} {{ mac-content-add | markdownify }}



{% capture win-content-add %}
  1. Start the ssh-agent in the background.

    eval "$(ssh-agent -s)"
    Agent pid 59566
    
  2. Add your SSH private key to the ssh-agent.

    $ ssh-add ~/.ssh/id_rsa
    

    If you created your key with a different name or have an existing key with a different name, replace id_rsa in the command with the name of your private key file.

{% endcapture %} {{ win-content-add | markdownify }}



{% capture linux-content-add %}
  1. Start the ssh-agent in the background.

    eval "$(ssh-agent -s)"
    Agent pid 59566
    
  2. Add your SSH private key to the ssh-agent.

    $ ssh-add ~/.ssh/id_rsa
    

    If you created your key with a different name or have an existing key with a different name, replace id_rsa in the command with the name of your private key file.

{% endcapture %} {{ linux-content-add | markdownify }}