chore(pre-commit): require GPG/SSH-signed commits on push#521
Merged
Conversation
Adds a local pre-push hook that runs git verify-commit over every commit in the push range. Rejects pushes containing unsigned, bad, or revoked signatures (statuses N/B/R/X/Y/E); accepts G (good) and U (good but unknown trust DB locally). Behavior: - pre-commit framework now installs into BOTH pre-commit and pre-push via default_install_hook_types. Devs need to re-run `pre-commit install` once after pulling main. - Bypass intentionally with `git push --no-verify`. - Clear error message points to the re-sign recipe. Companion to HomericIntelligence/ProjectMnemosyne#1718 (pilot).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a local pre-push hook that runs
git verify-commitover every commit being pushed. Rejects unsigned, bad, or revoked signatures.Org-wide rollout — companion to HomericIntelligence/ProjectMnemosyne#1718 (pilot).
How it works
pre-commitandpre-pushviadefault_install_hook_types.git push, the hook reads stdin (<local_ref> <local_sha> <remote_ref> <remote_sha>) and verifies every commit in the range.git log --format='%G?'): G/U pass; N/B/R/X/Y/E fail.pre-commit run --hook-stage pre-push --all-files.After merging
Each developer must re-run
pre-commit installonce. Without it,git pushstill works (no in-repo enforcement of installation).Bypass
git push --no-verify(rare — e.g. CI fixup worktrees without gpg-agent).Test plan
pre-commit installwires both hooks.