2

I tried to add this to ~/.ssh/config file, but it doesn't help. Seems like it doesn't work for macOS Monterey anymore.

Host *
   AddKeysToAgent yes
   IdentityFile ~/.ssh/id_rsa
   UseKeychain yes
Serhii
  • 73
  • 1
    Finally, I found a solution https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically#433667 – Serhii Aug 02 '22 at 17:52

1 Answers1

12

Prior to MacOS Monterrey the -K flag was used to add the key to the agent but since then and now in the new MacOS Ventura 13, we have a couple of different and more descriptive options:

--apple-use-keychain
--apple-load-keychain

The -K and -A flags are deprecated and have been replaced by the these new flags, respectively.

Now, I also had to add this line to my .zshrc file in order for ssh-add to load my passphrase on every session:

ssh-add --apple-load-keychain -q

The -q flag is to prevent from showing this message in every shell session but not a must:

Identity added: /Users/alex/.ssh/id_ed25519 ([email protected])

Hopefully it will save some time to someone in the same situation as me after OS X upgrade.