👋 We've unified all of GitHub's product documentation in one place! Check out the content for REST API, GraphQL API, and Developers. Learn more on the GitHub blog.
Article version: Enterprise Server 2.19

Error: ssh-add: illegal option -- K

This error means your version of ssh-add does not support macOS keychain integration, which allows you to store your passphrase in the keychain.

In this article

Were you able to find what you were looking for?

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.

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:

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

Note: If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.

Further reading

Were you able to find what you were looking for?

Ask a human

Can't find what you're looking for?

Contact us