Skip to content

Instantly share code, notes, and snippets.

@sug0
Created July 27, 2023 20:46
Show Gist options
  • Save sug0/0d7fe213baeff3b37022c3bf7f36c6bc to your computer and use it in GitHub Desktop.
Save sug0/0d7fe213baeff3b37022c3bf7f36c6bc to your computer and use it in GitHub Desktop.
ZSH git hook to sign commits with git-signify
#!/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