Added script to configure auto gpg signing

This commit is contained in:
Michele Cereda
2022-09-22 11:51:37 +02:00
parent 588a148897
commit ff5252f4f2
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
#!/bin/zsh
: "${USER_EMAIL:?required but not set}"
: "${SIGNING_KEY:=$(\
gpg --list-keys --keyid-format short "${USER_EMAIL}" \
| grep --extended-regexp '^pub[[:blank:]]+[[:alnum:]]+/[[:alnum:]]+[[:blank:]].*\[[[:upper:]]*S[[:upper:]]*\]' \
| awk '{print $2}' \
| cut -d '/' -f 2 )}"
: "${SIGNING_KEY:?something went wrong}"
for REPOSITORY in $(find $@ -type d -name .git -exec dirname {} +)
do
git -C "$REPOSITORY" config --local user.email "$USER_EMAIL"
git -C "$REPOSITORY" config --local user.signingKey "$SIGNING_KEY"
git -C "$REPOSITORY" config --local commit.gpgsign true
git -C "$REPOSITORY" --no-pager config --list --show-origin
done