From eefe6eb9a1794fca66c02ec904ca73d816477e2f Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Thu, 4 Apr 2024 22:55:35 +0200 Subject: [PATCH] git: autoselect first -sk ssh key from agent for signing --- .config/git/signing-key.sh | 3 +++ .gitconfig | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100755 .config/git/signing-key.sh diff --git a/.config/git/signing-key.sh b/.config/git/signing-key.sh new file mode 100755 index 0000000..aed9246 --- /dev/null +++ b/.config/git/signing-key.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +ssh-add -L | awk '/^sk-ssh/ { print "key::" $1 " " $2 }' diff --git a/.gitconfig b/.gitconfig index f6ad666..5bf2e93 100644 --- a/.gitconfig +++ b/.gitconfig @@ -10,7 +10,7 @@ compression = 3 [user] useConfigOnly = true -signingKey = key::sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFtd5SEEgKWzR6617GqxhSIi//4Afq7iRP0ny6fbwU7kAAAABHNzaDo= +# signingKey = key::sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFtd5SEEgKWzR6617GqxhSIi//4Afq7iRP0ny6fbwU7kAAAABHNzaDo= [column] ui = auto @@ -134,6 +134,7 @@ format = ssh [gpg "ssh"] allowedSignersFile = ~/.config/git/allowed_signers +defaultKeyCommand = /home/dln/.config/git/signing-key.sh [user] name = Daniel Lundin