gitsignaturegnupggpg-signaturegpg-agent

How can I stop git from use of GUI PGP key manager when signing a commit?


I am working in terminal via ssh. When I commit, I am asked for a password to unlock my private key. As long as I have no graphical session running everything works as expected.

The problem is that when I have an graphical session running (XFCE), I am asked for the password in that session rather in the terminal. How can I force git/gpg2 to ask for password in the terminal when the graphical session is running?

I use Ubuntu 20.04 LTS.


Solution

  • You might need a gpg-agent.conf with a --pinentry-program set to /usr/bin/pinentry-tty (as in here). Add export GPG_TTY=$(tty) to your ~/.bashrc.

    Or, as suggested here, call gpg with:

    gpg --pinentry-mode loopback --export-secret-keys -a | less