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.)
This commit is contained in:
parent
56d0dc57f4
commit
3f8dace325
1 changed files with 7 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue