Skip to content

Commit

Permalink
Load :prezto:module:ssh:load identities on macOS
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
slarew committed Oct 6, 2017
1 parent 9ed292b commit 8430fb8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/ssh/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8430fb8

Please sign in to comment.