trying to get ssh to work nicely with gpg-agent

This commit is contained in:
Adam Goldsmith 2015-04-27 16:58:27 -04:00
parent 1d2c7f30d4
commit 73e4345aee
2 changed files with 13 additions and 7 deletions

View File

@ -41,12 +41,16 @@ if grep 'enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then
gpg-connect-agent UPDATESTARTUPTTY /bye >/dev/null
}
add-zsh-hook preexec _gpg-agent-update-tty
_gpg-agent-update-tty
fi
# Clean up.
unset _gpg_agent_{conf,env}
# Disable GUI prompts inside SSH.
if [[ -n "$SSH_CONNECTION" ]]; then
#if [[ -n "$SSH_CONNECTION" ]]; then
# export PINENTRY_USER_DATA='USE_CURSES=1'
#fi
# Disable GUI prompts
export PINENTRY_USER_DATA='USE_CURSES=1'
fi

View File

@ -19,15 +19,17 @@ _ssh_agent_env="${_ssh_agent_env:-${TMPDIR:-/tmp}/ssh-agent.env}"
# Set the path to the persistent authentication socket.
_ssh_agent_sock="${TMPDIR:-/tmp}/ssh-agent.sock"
source "$_ssh_agent_env" 2> /dev/null
# Start ssh-agent if not started.
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
# Export environment variables.
source "$_ssh_agent_env" 2> /dev/null
# Start ssh-agent if not started.
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
fi
# # Start ssh-agent if not started.
# if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
# eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
# fi
fi
# Create a persistent SSH authentication socket.