Interview Prep/Git & GitHub/Protection, Hooks and Policy

Auditors want every commit on `main` to be verified as signed.

IntermediateScenarioProtection, Hooks and Policy
Answer

Situation read → Enforcement and developer setup both matter.

What I'd do →

  1. Enable "Require signed commits" in the ruleset for main.
  2. Give developers a signing setup, for example SSH signing:
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
  1. Upload the same key to GitHub as a "Signing key".
  2. With squash or web merges, GitHub signs the resulting commit itself.

Why → Branch rules reject unsigned pushes, so signing is not optional.

Interview tip → Mention that rebase-merge breaks signatures because the commits are re-created.

All Git & GitHub questions Roadmap: Git & GitHub

More on Protection, Hooks and Policy