I am setting up a new machine and would prefer to use keybase for various pgp activities like signing commits. I can run a command like
$ keybase pgp sign -m foo > x
$ gpg --verify x 2>&1 | grep -oF 'Good signature'
Good signature
I could sign things directly with gpg, but it's convenient to let keybase manage the thing. So can I somehow make git use keybase?
Git configuration doesn't seem to have a way to customize the gpg command that it uses to sign commits. All you can do is provide the key. Is there any way to do it?
Thanks to the link in Xavier's answer I learned that I can override the gpg program with the gpg.program configuration:
So I can use this to write a wrapper around keybase.
But git is, as it turns out, pretty finicky about what that
something
is. Git expects to partially parse the output that results from the--fd-status
flag, which causesgpg
to output special status codes at an alternate filehandle.Fortunately, at least for my first pass, git doesn't parse everything that gpg produces, so I was able to emulate it. Here's a gist with a functional wrapper, and here's the meat of it: