Subject: Re: Calling "gpg --sign" with loopback pinentry in some scenarios, but not always

From: Junio C Hamano <[email-masked]>
Date: Sat, 17 Feb 2024 15:31:01 -0800

Jens Schmidt <[email-masked]> writes:

> It seems that "git" does not have any hooks to pass arbitrary
> additional parameters to "gpg", right?  So my only reasonable
> option would be a Emacs/Magit-specific "gpg"-wrapper that adds
> command line parameter "--pinentry-mode loopback" to the wrapped
> "gpg" executable.

Correct.  You can point your gpg.program configuration variable at
your wrapper, perhaps

    $ cat >"$HOME/bin/mygpg-with-pinentry" <<\EOF
    #!/bin/sh
    exec gpg --pinentry-mode loopback "$@"
    EOF
    $ chmod +x "$HOME/bin/mygpg-with-pinentry"
    $ git config gpg.openpgp.program "$HOME/bin/mygpg-with-pinentry"

or something like that.  It is unfortunate that

    $ git config gpg.openpgp.program "gpg --pinentry-mode loopback"

does not work.