Branch protection is a repository control that restricts how changes reach selected branches. It supports traceability, mandatory review, segregation of duties, and standardized CI/CD practices. section 11.1.1 section 11.4
Configure branch protection to enforce controls such as:
- Require signed commits so GitHub rejects pushes containing unverified commits. section 11.1.1
- Require pull requests and approvals before changes merge into the main branch. section 11.2
- Prevent administrators from bypassing the rule; changes to protection settings remain visible in audit logs. section 11.2
- Add CODEOWNERS when review responsibility must be separated among designated owners. section 11.2
Signed-commit workflow
Generate a GPG key, configure Git with user.signingkey, enable commit.gpgsign, and create signed commits with git commit -S -m "Your commit message". When an unverified commit is pushed, the protected branch blocks it. section 11.1.1
Figure 11.4 Branch protection rules
Use the branch-protection configuration view to locate pull-request, approval, and administrator-bypass controls. section 11.2
