I have a arch linux in vm, I imported my gpg keys and configs gpg as described here:
https://github.com/drduh/YubiKey-Guide
and also config pass & git to use gpg keys, and everything works fine,
so for example when I run git pull for first time it asks me the password,
the problem is:
when I restart my vm, before I can run any command(like git pull),I have to run this command:
gpg-connect-agent updatestartuptty /bye
then everything works fine,
How can I solve this issue?
GPG depends on
pinentryto provide user interaction for typing the passwords such as the one to protect your smartcard. In order to function properly,pinentry(which, on terminal, is eitherpinentry-ttyorpinentry-curses) needs to know which tty it should listen for user interaction.When GPG is acting as your
ssh-agentto provide git+ssh authentication, it will keep a reference of the firstttyavailable when it started, which is not the same you will have when you connect to your VM. Unfortunately,gpg-agenthas no way to know at runtime whichttyyou are connected to, so it will fail every time it tries to communicate with its startuptty. That's why you need to update the startup tty using that command. This behavior is shortly described on their docs.An alternative to avoid that command every time is to use any
pinentryapplication that does not rely ontty, such as GUI ones likepinentry-gtk-2,pinentry-gnomeand so on.