1
0
Fork 0

Load :prezto:module:ssh:load identities on macOS

If the user defines identities in `:prezto:module:ssh:load`, always try
to load them, even on macOS.  On macOS, also try to load Keychain
managed identities. (Assume if a user adds an identity to Keychain then
the use would want those identities automatically loaded.)
pull/1394/head
Stephen Larew 7 years ago
parent 56d0dc57f4
commit 3f8dace325

@ -44,12 +44,16 @@ if ssh-add -l 2>&1 | grep -q 'The agent has no identities'; then
# passphrase. # passphrase.
if [[ -n "$DISPLAY" && -x "$SSH_ASKPASS" ]]; then if [[ -n "$DISPLAY" && -x "$SSH_ASKPASS" ]]; then
ssh-add "${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}}" < /dev/null 2> /dev/null ssh-add "${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}}" < /dev/null 2> /dev/null
elif [[ "$OSTYPE" == darwin* ]]; then
# macOS: `ssh-add -A` will load all identities defined in Keychain
ssh-add -A 2> /dev/null
else else
ssh-add ${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}} 2> /dev/null ssh-add ${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}} 2> /dev/null
fi fi
if [[ "$OSTYPE" == darwin* ]]; then
# macOS: `ssh-add -A` will load all identities defined in Keychain.
# Assume `/usr/bin/ssh-add` is Apple customized version that understands
# the `-A` switch.
/usr/bin/ssh-add -A
fi
fi fi
# Clean up. # Clean up.

Loading…
Cancel
Save