Created
July 27, 2023 20:46
-
-
Save sug0/0d7fe213baeff3b37022c3bf7f36c6bc to your computer and use it in GitHub Desktop.
ZSH git hook to sign commits with git-signify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# get git-signify from: https://github.com/sug0/git-signify | |
set -e | |
printf 'Sign commit (y/n)? ' | |
read -sk yn | |
echo $yn | |
case $yn in | |
y|Y) | |
_commit=$(git rev-parse HEAD) | |
for i in {1..3}; do | |
git signify sign -k $GIT_KEY_SEC $_commit >/dev/null && exit 0 | |
done | |
echo Exhausted all 3 attempts to sign commit | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment