Re: [PATCH] gpg-interface: allow selecting key id with env variable
- From
Fabian Stelzer <fs@gigacodes.de>
- Date
- Oct 25, 2021, 07:31 UTC
- Message-ID
- <8661a491-5ef1-a469-878f-7dd81d4a1aa2@gigacodes.de>
- In-Reply-To
- <YXXMroOBvDERXIMP@octopus.int.carobme.de>
On 24.10.21 23:14, Marco Beck wrote:
Show 11 quoted lines
> On Sun, Oct 24, 2021 at 01:35:04PM -0700, Junio C Hamano wrote: > >> Can you explain why we want to add another way to specify the key? > > Motivation for that patch was that I usually use the same .gitconfig > (all dotfiles actually) with multiple identities (e.g. company and private > email address). It's really convenient to switch to a different identity > for the rest of the session by just setting e.g. $GIT_AUTHOR_EMAIL and not > needing to remember adding --author to every invocation of git-commit(1) > etc. Thought it would be nice to have that convenience for selecting a > signing key as well.
If you only need to rarely change the key to sign with, the commands usually have a direct parameter to do so: git tag -s -u <keyid> git commit -S<keyid>
Otherwise https://git-scm.com/docs/git-config#_conditional_includes might be useful if you can store you private & work git in separate directories or only have a few selected repos per identity. Put all your defaults in your .gitconfig and use sth like:
[includeIf "gitdir:~/projects/work/"] path = ".gitconfig.work"
to override them.
Kind regards, Fabian