Not Stupid SSH Tricks: Automatic ssh-add
If you password protect your SSH keys (and you should) and you don’t store those passwords in your macOS keychain or Linux equivalent (slightly paranoid, but not a bad idea), you have to add keys to ssh-agent with ssh-add before using them. Otherwise, you’ll be prompted for the key’s password on each use. This always bites me when doing deploys, I get prompted multiple times as the deploy process makes multiple SSH connections.
Fortunately, there’s a simple fix.
All you need to do is add:
.ssh/config. Just it as says on the label, keys are
automatically added to the SSH Agent when they are used. You’ll be
prompted for the password on its first use, no need to add it
separately. This works not only with
ssh itself, but with things
like Git, that use SSH under the hood. Boom!