Purpose of adding ssh identity file to ssh agent and keychain

I noticed that the Github instructions for adding an ssh key to your account say that you need to add the key to both your ~/.ssh/config file AND to the ssh agent with ssh-add

enter image description hereenter image description here

But, I just noticed however that if I clear the keys from the ssh agent with ssh-add -D, then I'm still able to push and pull from my github repos just fine. I think this makes sense because in my ~/.ssh/config file, I specify that for Host * (all hosts), the exact IdentityFile to use, so it will use that one automatically.

So, my question is - why even add the key to the ssh-agent directly at all? Is there a case in which my way of only added to the ~/.ssh/config file won't work?

2

1 Answer

I hope you set a passphrase on that identity-file?

If you didn't you probably won't notice a difference; if you did, adding it to the agent will allow you to enter the passphrase ONCE for the life-time of the running agent (or till you clear the identity).

W/o the agent I'd expect you to be prompted for every connection attempt.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like