Better SSH configuration
Add to .ssh/config:
Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye"
Don't add:
gpg-connect-agent updatestartuptty /bye > /dev/null
or
gpgconf --launch gpg-agent
to rc file.
This makes sure pinentry starts on the terminal that is executing the ssh command, not the one where gpg-agent was started, or whichever one you last ran gpg-connect-agent updatestartuptty /bye on. And then you don't need those other startup commands in your rc file, since gpg-connect-agent will run for every ssh command.
Reference: https://bugzilla.mindrot.org/show_bug.cgi?id=2824#c9
Maybe I'm missing something?
gpg-connect-agent: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg-connect-agent: can't connect to the agent: Permission denied
gpg-connect-agent: error sending standard options: No agent running
I found that having gpg-connect-agent updatestartuptty /bye > /dev/null in my ~/.bashrc and also having gpg-connect-agent updatestartuptty /bye > /dev/null in my ~/.ssh/config fixed the issue of the pinentry-ncurses showing up in the wrong terminal.
I still haven't been able to get this working as described. If you'd like to include this in the guide as a troubleshooting tip, that would be welcome in a PR.