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:
- My machine OS environment is Ubuntu 24.04 with KDE Plasma 5.27.12 Wayland session.
- 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.gpgsignisTrueanduser.signingKeyis set . (So actually I do not even need to have-Sin the git command.) - 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
- The current
pinentryispinentry-gnome3. I also triedpinentry-gtk-2andpinentry-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
- I created
~/.gnupg/gpg-agent.configwith 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
- I tried to both set and unset
GPG_TTYwith current tty session file name in either~/.bashrc,~/.profileand/etc/profile. - I tried to restart the gpg agent with all the following:
killall gpg-agentgpgconf --kill gpg-agentgpg-connect-agent reloadagent /byereboot
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?