Skip to content

Instantly share code, notes, and snippets.

@vertexvaar
Created November 21, 2017 20:34
Show Gist options
  • Save vertexvaar/7ac5d51d81b91357ef36672e7043f9b8 to your computer and use it in GitHub Desktop.
Save vertexvaar/7ac5d51d81b91357ef36672e7043f9b8 to your computer and use it in GitHub Desktop.
git pre-receive hook to decline non-signed commits
#!/bin/sh
status=0
while read oldrev newrev refname
do
git verify-commit "$newrev" 2>&- >&-
if [ $? -ne 0 ]; then
echo "[GPG] Missing signature"
status=1
else
echo "[GPG] Signature verfied"
fi
done
exit "$status";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment