How to make GPG make a GUI password popup when doing the Git commit signing
10:13 19 Aug 2025

Every time when I was doing the GPG signed git commit (e.g. git commit -S -s -m "test"), the password prompt is in the CLI console. The password prompt before was a proper GUI pop up window but it was changed by one of my colleagues when he tried to commit some changes from my machine. He did all of those in a TTY session with root account. He did not remember what he has done to the environment. I want to make GPG signing work as before.

The following keys are what I have checked and done on my machine:

  1. My machine OS environment is Ubuntu 24.04 with KDE Plasma 5.27.12 Wayland session.
  2. Git is aware of the GPG keyring with the environment variable set like export GIT_CONFIG_GLOBAL="/home/user/.gitconfig_company". In the file .gitconfig_company, commit.gpgsign is True and user.signingKey is set . (So actually I do not even need to have -S in the git command.)
  3. There are various variants of pinentry:
$ ls /usr/bin/pinentry*
/usr/bin/pinentry  /usr/bin/pinentry-curses  /usr/bin/pinentry-gnome3  /usr/bin/pinentry-gtk-2  /usr/bin/pinentry-qt  /usr/bin/pinentry-x11
  1. The current pinentry is pinentry-gnome3. I also tried pinentry-gtk-2 and pinentry-qt.
$ sudo update-alternatives --config pinentry
There are 4 choices for the alternative pinentry (providing /usr/bin/pinentry).

  Selection    Path                      Priority   Status
------------------------------------------------------------
* 0            /usr/bin/pinentry-gnome3   90        auto mode
  1            /usr/bin/pinentry-curses   50        manual mode
  2            /usr/bin/pinentry-gnome3   90        manual mode
  3            /usr/bin/pinentry-gtk-2    85        manual mode
  4            /usr/bin/pinentry-qt       80        manual mode
  1. I created ~/.gnupg/gpg-agent.config with all of the following config:
default-cache-ttl 600
pinentry-program /usr/bin/pinentry-gnome3
default-cache-ttl 600
pinentry-program /usr/bin/pinentry-gtk-2
default-cache-ttl 600
pinentry-program /usr/bin/pinentry-qt
  1. I tried to both set and unset GPG_TTY with current tty session file name in either ~/.bashrc, ~/.profile and /etc/profile.
  2. I tried to restart the gpg agent with all the following:
    • killall gpg-agent
    • gpgconf --kill gpg-agent
    • gpg-connect-agent reloadagent /bye
    • reboot

I have tried all possible combinations of the steps above and GPG still asks for password in the CLI instead of popup window. VSCode also reports gpg: cannot open '/dev/tty': No such device or address.

Now I have no idea what to do next. What should I do next to make the GPG password prompt as a pop up GUI window?

bash git gnupg