From 532ff72b8bb77c3932ea9a0f4e15bd8e5bcb841f Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Thu, 9 Nov 2023 14:46:05 +1100 Subject: [PATCH] Hackily set gpg.program to work around Tower's weird design --- dot-config/git/config | 23 ++++++++++++++++++++--- dot-config/git/tools/gpg-for-git-signing | 3 +++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 dot-config/git/tools/gpg-for-git-signing diff --git a/dot-config/git/config b/dot-config/git/config index fdacfae..7f095c0 100644 --- a/dot-config/git/config +++ b/dot-config/git/config @@ -70,9 +70,6 @@ process = git-lfs filter-process required = true -[gpg] - program = gpg-for-git-signing - [help] autocorrect = 20 @@ -110,6 +107,26 @@ [url "git@git.00dani.me:"] pushInsteadOf = https://git.00dani.me/ +# This is a frankly ridiculous hack. Tower (https://www.git-tower.com) supports +# signing and verifying with GPG, but it requires you to select a GPG binary in +# its settings, and it overwrites the value of gpg.program in your Git config +# to be an absolute path when you do this. This is a problem if you reuse your +# Git config across platforms where GPG might be in different places, which I +# do. In my opinion it's a bug in how Tower works, but I've tried contacting +# support about it and they won't change it. So hacks it is. +[gpg] + program = /usr/local/bin/gpg + +# The workaround is to specify the absolute GPG path that Tower wants first +# (above). Tower will see this setting and its GPG functionality will work +# properly. Then, the gpg.program setting I actually want is stored in an +# include file, and that include file is loaded conditionally using includeIf. +# Tower doesn't seem to understand this, but Git does. The condition I've used +# is always true, so Git itself always loads this file and my gpg.program +# setting is overridden with the correct one. +[includeIf "onbranch:**"] + path = tools/gpg-for-git-signing + [include] path = tools/kdiff3 path = tools/kitty-diff diff --git a/dot-config/git/tools/gpg-for-git-signing b/dot-config/git/tools/gpg-for-git-signing new file mode 100644 index 0000000..cbc806d --- /dev/null +++ b/dot-config/git/tools/gpg-for-git-signing @@ -0,0 +1,3 @@ +# vim: ft=gitconfig +[gpg] + program = gpg-for-git-signing