This allows selecting the gpg(1) key id to use for signing by setting the environment variable GIT_GPG_SIGNINGKEY. Signed-off-by: Marco Beck <mbeck@xxxxxxxxxxxxxx> --- Documentation/git.txt | 6 ++++++ gpg-interface.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git Documentation/git.txt Documentation/git.txt index d63c65e67d..ab032f2760 100644 --- Documentation/git.txt +++ Documentation/git.txt @@ -941,6 +941,12 @@ corresponding standard handle, and if `GIT_REDIRECT_STDERR` is `2>&1`, standard error will be redirected to the same handle as standard output. +`GIT_GPG_SIGNINGKEY`:: + If this environment variable is set, then Git commands which use + `gpg(1)` for signing (e.g. linkgit:git-commit[1], linkgit:git-tag[1]) + will use the specified key. See also the `user.signingkey` option in + linkgit:git-config[1]. + `GIT_PRINT_SHA1_ELLIPSIS` (deprecated):: If set to `yes`, print an ellipsis following an (abbreviated) SHA-1 value. This affects indications of diff --git gpg-interface.c gpg-interface.c index 127aecfc2b..10e923140c 100644 --- gpg-interface.c +++ gpg-interface.c @@ -435,6 +435,11 @@ int git_gpg_config(const char *var, const char *value, void *cb) const char *get_signing_key(void) { + const char *signing_key; + + if ((signing_key = getenv("GIT_GPG_SIGNINGKEY"))) + return signing_key; + if (configured_signing_key) return configured_signing_key; return git_committer_info(IDENT_STRICT|IDENT_NO_DATE); -- 2.32.0