1
0
Fork 0

add store passphrases in your keychain. only macOS

update for macOS, never ask passphaeses after save to keychain
---
https://apple.stackexchange.com/a/250572
pull/1642/head
Und3fined 6 years ago committed by GitHub
parent e6eea17b12
commit fef4d4ae51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,9 @@ _ssh_agent_env="${_ssh_agent_env:-${TMPDIR:-/tmp}/ssh-agent.env.$UID}"
# Set the path to the persistent authentication socket.
_ssh_agent_sock="${TMPDIR:-/tmp}/ssh-agent.sock.$UID"
# default options
_ssh_add_options=""
# Start ssh-agent if not started.
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
# Export environment variables.
@ -36,6 +39,11 @@ if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
export SSH_AUTH_SOCK="$_ssh_agent_sock"
fi
# store passphrases in your keychain. only macOS
if [[ "$(uname 2> /dev/null)" == "Darwin" ]]; then
_ssh_add_options="-K"
fi
# Load identities.
if ssh-add -l 2>&1 | grep -q 'The agent has no identities'; then
zstyle -a ':prezto:module:ssh:load' identities '_ssh_identities'
@ -50,9 +58,9 @@ if ssh-add -l 2>&1 | grep -q 'The agent has no identities'; then
# program specified by SSH_ASKPASS and open an X11 window to read the
# passphrase.
if [[ -n "$DISPLAY" && -x "$SSH_ASKPASS" ]]; then
ssh-add ${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}} < /dev/null 2> /dev/null
ssh-add $_ssh_add_options ${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}} < /dev/null 2> /dev/null
else
ssh-add ${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}} 2> /dev/null
ssh-add $_ssh_add_options ${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}} 2> /dev/null
fi
fi

Loading…
Cancel
Save