I have a Github account linked with 2 email addresses, (Personal + work). I'm only able to sign commits coming from one account, using git config --global user.signingkey MySigningKey
because the key is associated with one email.
I'm using direnv to commit using different emails depending on the directory that I'm in, it works setting an .envrc with an enviroment variable like export [email protected]
.
I was wondering if there was a similar solution to define dynamic signing keys
Note: if your email is stored in the local configuration of a Git repository (with git config user.email), your commit will use the right email when you need to sign commits.
Meaning you would not need
direnv
.In order to avoid the global setting to interfere with repositories using the other email, you could:
user.signingkey
only in the repositories using the correctuser.email
.user.signingkey
option global for that separate account)