sorin-ionescu/prezto — pull request #736 by gdetrez (2014-11-27 03:45:18+00:00)
Title: Add a hook to set the gpg-agent tty

Using the gpg-agent with ssh can be a problem when using multiple tty (like with tmux). According to gpg documentation:
> SSH has no way to tell the gpg-agent what terminal or X display it is running on. So when remotely logging into a box where a gpg-agent with SSH support is running, the pinentry will get popped up on whatever display the gpg-agent has been started. To solve this problem you may issue the command
> ```
> echo UPDATESTARTUPTTY | gpg-connect-agent
> ```
> and the next pinentry will pop up on your display or screen. However, you need to kill the running pinentry first because only one pinentry may be running at once. If you plan to use ssh on a new display you should issue the above command before invoking ssh or any other service making use of ssh.

This proposed solution updates the tty before every command (if you use gpg-agent for ssh). Maybe there's a way to be a bit more selective but I don't know how :confused:.