Jens Schmidt [off-list ref] 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.