parent
9d504d2d93
commit
d817e80741
@ -27,22 +27,22 @@ else
|
|||||||
source "$_ssh_agent_env" 2> /dev/null
|
source "$_ssh_agent_env" 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load identities.
|
|
||||||
if ssh-add -l 2>&1 | grep 'The agent has no identities'; then
|
|
||||||
zstyle -a ':prezto:module:ssh:load' identities '_ssh_identities'
|
|
||||||
if (( ${#identities} > 0 )); then
|
|
||||||
ssh-add "$_ssh_dir/${^_ssh_identities[@]}"
|
|
||||||
else
|
|
||||||
ssh-add
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create a persistent SSH authentication socket.
|
# Create a persistent SSH authentication socket.
|
||||||
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
|
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
|
||||||
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock"
|
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock"
|
||||||
export SSH_AUTH_SOCK="$_ssh_agent_sock"
|
export SSH_AUTH_SOCK="$_ssh_agent_sock"
|
||||||
fi
|
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'
|
||||||
|
if (( ${#_ssh_identities} > 0 )); then
|
||||||
|
ssh-add "$_ssh_dir/${^_ssh_identities[@]}" 2> /dev/null
|
||||||
|
else
|
||||||
|
ssh-add 2> /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean up.
|
# Clean up.
|
||||||
unset _ssh_{dir,identities} _ssh_agent_{env,sock}
|
unset _ssh_{dir,identities} _ssh_agent_{env,sock}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user