From 8430fb821c2ead5a3db45190232df949d694a022 Mon Sep 17 00:00:00 2001 From: Stephen Larew Date: Fri, 6 Oct 2017 11:01:06 -0400 Subject: [PATCH] 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.) --- modules/ssh/init.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/ssh/init.zsh b/modules/ssh/init.zsh index de11c013f2..b32c3fd4e9 100644 --- a/modules/ssh/init.zsh +++ b/modules/ssh/init.zsh @@ -44,12 +44,16 @@ if ssh-add -l 2>&1 | grep -q 'The agent has no identities'; then # passphrase. if [[ -n "$DISPLAY" && -x "$SSH_ASKPASS" ]]; then 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 ssh-add "${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}}" 2> /dev/null 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 # Clean up.