threads / discuss / 54510

git-receive-pack doesn't seem to respect gpg.program config

Subject: git-receive-pack doesn't seem to respect gpg.program config

## tl;dr

2 messages between Oct 26, 2020 and Oct 26, 2020.

replies: 1people: 2as markdown or json

Konstantin Ryabitsev· Oct 26, 2020, 18:16 UTC · lore
Hi, all:

While trying to configure signed pushes, I found out that no mater where I set gpg.program=/opt/gnupg22/bin/gpg (in-repo config, ~/.gitconfig, /etc/gitconfig), git-receive-pack didn't appear to be paying any attention to that setting and always used the "gpg" command in the PATH.

Not sure if that's intentional or not, but seems like it should be paying attention at least to /etc/gitconfig.

-K
Jeff King· Oct 26, 2020, 19:36 UTC · re: Konstantin Ryabitsev · lore

Re: git-receive-pack doesn't seem to respect gpg.program config

On Mon, Oct 26, 2020 at 02:16:25PM -0400, Konstantin Ryabitsev wrote:
Show 7 quoted lines
> While trying to configure signed pushes, I found out that no mater where 
> I set gpg.program=/opt/gnupg22/bin/gpg (in-repo config, ~/.gitconfig, 
> /etc/gitconfig), git-receive-pack didn't appear to be paying any 
> attention to that setting and always used the "gpg" command in the PATH.
> 
> Not sure if that's intentional or not, but seems like it should be 
> paying attention at least to /etc/gitconfig.
I suspect it just needs:
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index bb9909c52e..2a41b24e5a 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -248,6 +248,10 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
+	status = git_gpg_config(var, value, cb);
+	if (status)
+		return status;
+
 	return git_default_config(var, value, cb);
 }
 

but didn't test or look further than that.

-Peff

← back to recent threads