跳至主要内容

错误:ssh-add:非法选项 -- apple-use-keychain

此错误表示您使用的 ssh-add 版本不支持 macOS 密钥串集成,该功能可让您将密码短语存储在密钥串中。

本文内容

The --apple-use-keychain 选项位于 Apple 标准版的 ssh-add 中,当您将 SSH 密钥添加到 ssh-agent 时,它会为您将密码短语存储在密钥串中。如果您安装了不同版本的 ssh-add,可能不支持 --apple-use-keychain

解决此问题

要将您的 SSH 私钥添加到 ssh-agent,您可以指定 Apple 版本的 ssh-add 的路径。

/usr/bin/ssh-add --apple-use-keychain ~/.ssh/id_ed25519

注意

  • --apple-use-keychain 选项位于 Apple 标准版的 ssh-add 中。在 macOS Monterey (12.0) 之前的版本,请使用 -K 而不是 --apple-use-keychain
  • 如果您使用了其他名称创建密钥,或正在添加一个已有的、名称不同的密钥,请在命令中将 id_ed25519 替换为您的私钥文件名。

延伸阅读

© . This site is unofficial and not affiliated with GitHub, Inc.