Here's my setup, not 100 % tested yet:
Added in ~/.bash_profile:
GAIFILE=$HOME/.gpg-agent-info if test -f "${GAIFILE}" && kill -0 `cut -d: -f 2 "${GAIFILE}"` 2>/dev/null; then eval `cat "${GAIFILE}"` eval `cut -d= -f 1 < "${GAIFILE}" | xargs echo export` else eval `gpg-agent --use-standard-socket --write-env-file --enable-ssh-support --daemon` fi # To update TTY use: echo UPDATESTARTUPTTY | gpg-connect-agent alias ssh=$HOME/bin/ssh-updated-tty
In ~/.bashrc:
GPG_TTY=`tty` export GPG_TTY
In ~/bin/ssh-updated-tty (remember to chmod +x):
echo UPDATESTARTUPTTY | gpg-connect-agent -q >/dev/null 2>&1 ssh $@
The extra TTY code is necessary when using different consoles (like e.g. Ctrl+Alt+F2)