1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Update "ssh-add: illegal option" article to prioritize new options (#44102)

This commit is contained in:
Steve Guntrip
2023-10-10 14:50:57 +01:00
committed by GitHub
parent 74efe6a754
commit 3c77351364
3 changed files with 12 additions and 9 deletions

View File

@@ -1,11 +1,12 @@
---
title: 'Error: ssh-add: illegal option -- K'
title: 'Error: ssh-add: illegal option -- apple-use-keychain'
intro: 'This error means your version of `ssh-add` does not support macOS keychain integration, which allows you to store your passphrase in the keychain.'
redirect_from:
- /articles/error-ssh-add-illegal-option-k
- /articles/error-ssh-add-illegal-option----k
- /github/authenticating-to-github/error-ssh-add-illegal-option----k
- /github/authenticating-to-github/troubleshooting-ssh/error-ssh-add-illegal-option----k
- /authentication/troubleshooting-ssh/error-ssh-add-illegal-option----k
versions:
fpt: '*'
ghes: '*'
@@ -13,26 +14,29 @@ versions:
ghec: '*'
topics:
- SSH
shortTitle: 'ssh-add: illegal option -- K'
shortTitle: 'ssh-add "illegal option" error'
---
The `-K` option is in 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 have installed a different version of `ssh-add`, it may lack support for `-K`.
The `--apple-use-keychain` option is in 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 have installed a different version of `ssh-add`, it may lack support for `--apple-use-keychain`.
## Solving the issue
To add your SSH private key to the ssh-agent, you can specify the path to the Apple version of `ssh-add`:
```shell
/usr/bin/ssh-add -K ~/.ssh/id_ed25519
/usr/bin/ssh-add --apple-use-keychain ~/.ssh/id_ed25519
```
{% note %}
**Note:** {% data reusables.ssh.add-ssh-key-to-ssh-agent %}
**Notes:**
- The `--apple-use-keychain` option is in Apple's standard version of `ssh-add`. In MacOS versions prior to Monterey (12.0), use `-K` instead of `--apple-use-keychain`.
- {% data reusables.ssh.add-ssh-key-to-ssh-agent %}
{% endnote %}
## Further reading
- "[AUTOTITLE](/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)"
- [Linux man page for SSH-ADD](http://man7.org/linux/man-pages/man1/ssh-add.1.html)
- [Linux man page for ssh-add](http://man7.org/linux/man-pages/man1/ssh-add.1.html)
- To view Apple's man page for SSH-ADD, run `man ssh-add` in Terminal

View File

@@ -22,9 +22,8 @@ children:
- /error-permission-to-userrepo-denied-to-other-user
- /error-permission-to-userrepo-denied-to-userother-repo
- /error-agent-admitted-failure-to-sign
- /error-ssh-add-illegal-option----k
- /error-ssh-add-illegal-option----apple-use-keychain
- /error-ssl-certificate-problem-verify-that-the-ca-cert-is-ok
- /error-unknown-key-type
- /error-were-doing-an-ssh-key-audit
---

View File

@@ -4,7 +4,7 @@
The `--apple-use-keychain` option is in Apple's standard version of `ssh-add`. In MacOS versions prior to Monterey (12.0), the `--apple-use-keychain` and `--apple-load-keychain` flags used the syntax `-K` and `-A`, respectively.
If you don't have Apple's standard version of `ssh-add` installed, you may receive an error. For more information, see "[Error: ssh-add: illegal option -- K](/articles/error-ssh-add-illegal-option-k)."
If you don't have Apple's standard version of `ssh-add` installed, you may receive an error. For more information, see "[AUTOTITLE](/authentication/troubleshooting-ssh/error-ssh-add-illegal-option----apple-use-keychain)."
If you continue to be prompted for your passphrase, you may need to add the command to your `~/.zshrc` file (or your `~/.bashrc` file for bash).