Skip to main content
We publish frequent updates to our documentation, and translation of this page may still be in progress. For the most current information, please visit the English documentation.

Error: ssh-add: illegal option -- K

このエラーは、ssh-add のバージョンが、パスフレーズをキーチェーンに保存できる、macOS のキーチェーン統合をサポートしていないことを意味しています。

-K オプションは、ssh-add の Apple の標準バージョンであり、ssh-agent に SSH キーを追加すると、パスフレーズがキーチェーンに自動的に格納されます。 別のバージョンの ssh-add をインストールしている場合は、-K のサポートがないことがあります。

問題の解決

SSH プライベートキーを ssh-agent に追加するには、ssh-add の Apple のバージョンへのパスを指定できます。

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

注: キーを別の名前で作成した場合、または別の名前の既存のキーを追加する場合は、コマンドの id_ed25519 を秘密キー ファイルの名前に置き換えます。

参考資料