#!/bin/sh # Reject pushes that include commits without a good signature. # Activated via core.hooksPath in ~/.config/git/config so it applies to # every repo unless that repo overrides hooksPath itself (this dotfiles # repo does, pointing at .githooks/ which has its own hooks). # # Bypass for one push: git push --no-verify set -eu zero=$(git hash-object --stdin &2 fi printf '\non %s:\n%s\n' "$remote_ref" "$bad" >&2 fail=1 fi done if [ "$fail" -ne 0 ]; then printf '\nfix with: git rebase --exec "git commit --amend --no-edit -S" \n' >&2 printf 'bypass: git push --no-verify\n\n' >&2 exit 1 fi exit 0