b10n1k
b10n1k

Reputation: 615

Get prompt for passphrase from terminal when you sign commits

i have my private gpg key in a remote machine and i have setup the user.signingkey. My problem now is that the git commit -S is hanging as it doesnt prompt me to enter the passphrase from the console.

To Import the keys i worked it around using --passphrase-fd 0 --pinentry-mode loopback but i have no idea how can i get prompt in the console with git.

Upvotes: 2

Views: 1280

Answers (1)

b10n1k
b10n1k

Reputation: 615

So what i did and learned from this. This happens because it start the session gpg-agent with --keep-display which forces it to be locked onto the display it started with. (at least on Tumbleweed). Such the dialog is always displayed on the remote display.

Now you can change this changing pinentry program. Check what program you have installed on the remote machine

❯ ls /usr/bin | grep pinentry
pinentry
pinentry-curses
pinentry-emacs
pinentry-gnome3
pinentry-tty

and then create a file ~/.gnupg/gpg-agent.conf add this to the file

pinentry-program /usr/bin/pinentry-tty

save and then restart the gpg-agent agent

gpg-connect-agent reloadagent /bye

To check the settings if you want you can use

gpgconf --list-options gpg-agent

Now if you configure the user.signingkey for the git, that should be work. The only problem i had with that it was that i had one line in my .zshrc which causing a segfault when i was trying to sign. When i removed it all was as it was expected. The line was export GPG_TTY=$(tty). So keep that in mind.

Upvotes: 3

Related Questions