Re: GPG signing for git commit?
From: Jeff King <hidden>
Date: 2016-06-15 22:46:38
On Fri, Apr 17, 2009 at 06:36:40PM +0000, Sitaram Chamarty wrote:
On 2009-04-17, Jeff King [off-list ref] wrote:quoted
quoted
If you set GIT_COMMITTER_*, won't it change the SHA of the commit itself? I always thought so...No. Pushing will never create a new commit, so there are no new SHA-1s calculated. But the reflog entry will contain GIT_COMMITTER_*, and is a simple text file.cool -- I didn't know this. Thanks! One last question: where do you set it, in the pre-commit hook on the server?
No, for two reasons:
1. The pre-commit hook is run when making a local commit. For pushing,
you would want the pre-receive hook.
2. Hooks are executed as child processes of receive-pack, so they
can't impact the environment it sees.
I think you would need to intercept the call to receive-pack (e.g., by
replacing it with a wrapper script), set the variables based on ssh keys
used (or whatever criteria you want), and then exec receive-pack.
-Peff