Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on PGP sign emails sent with git-send-email(1)

Parent

PGP sign emails sent with git-send-email(1)

+7
−0

How can we use git-send-email(1) to sign patches (emails) with the gpg(1) keyring?

I've heard it can be done, but couldn't find anything in the git-send-email(1) documentation nor in a web search.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+4
−0

How can we use git-send-email(1) to sign patches (emails) with the gpg(1) keyring?

The git-send-email command does not have any CLI options to perform cryptographic operations, so, to the best of my knowledge, you cannot really tell it to sign anything.

What you can do is sign commits with a GPG key using git commit -S after telling Git which key it should use, but these are commits, not patches or emails. In addition, this is only good for the repository into which the commits are made. When you use git format-patch, the GPG signature is not part of the *.patch files themselves (which is unfortunate).

The only alternatives off the top of my head are:

  1. manually send an email that is both encrypted (with your recipient's public GPG key) and signed (with your GPG private key) where you include the *.patch files as attachments; or
  2. tell the other person to directly git fetch or git pull from your branch where the GPG signed commits can be found; or
  3. rely on the "web of trust" principle where, in short, you accept patches only from people that you trust (i.e. how Linux kernel development is typically done).

Unfortunately, this means you're not really using git-send-email at this point, which is not what you originally wanted, but I hope at least one of the alternatives above can work for you.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

2 comment threads

3. web of trust (5 comments)
Fourth option (though probably not practical). (2 comments)
Fourth option (though probably not practical).
celtschk‭ wrote over 2 years ago

In principle, there's also the option to write a command line tool accepting sendmail-compatible options which does the signing before passing it on to whatever you use for sending mail, and instruct git to use that as sendmail executable. Maybe there already exists such an executable somewhere.

alx‭ wrote 8 months ago · edited 8 months ago

I didn't know of any, but I recently patched neomutt(1) to behave like that. See my new answer: https://software.codidact.com/posts/286573/291329#answer-291329

Usage:

.gitconfig:

[sendemail]
	sendmailcmd = neomutt -C -H - && true