SSH – Identity Not Loaded from Keychain at Startup on macOS Catalina

catalinamacosssh

I have configured a host in my ~/.ssh/config like this

Host pptest
IdentityFile ~/.ssh/id_rsa_test_2048_pp
UseKeychain yes
AddKeysToAgent yes

This key has a passphrase on it. As was my understanding, UseKeychain and AddKeysToAgent should automatically load the keys passphrase on reboot, however I have not found this to be the case. To get for instance a git-fetch (or any remote action involving ssh) working, I still need to run an

ssh-add

beforehand.

Why is this happening?

My system is 10.15.5 (19F96)

Best Answer

Have you done a ssh-copy-id of your public key to your host? If not the

UseKeychain yes
AddKeysToAgent yes

is meaningless, since the host has no way of verifying who you are, and will ask for the password or passphrase.
Take a look at Taming the terminal part 30/37 for an explanation.
Also man ssh-copy-id should give you more info.