Retroactively Sign Git Commits

It's a classic situation. You're contributing to a project, filed your pull request, and gotten it approved by your peers. You're all ready to merge your code and add your humble contribution to the project when, out of nowhere, GitHub gives you this:

GitHub error: Merging is blocked: The base branch requires all commits to be signed.

How do you go about doing this, especially when you've already committed your work and pushed it to the server? How do you retroactively sign your Git commits? We'll do this in six steps:

  1. Gather Information
  2. Install GPG
  3. Create or use a key
  4. Set up Git to sign commits using GPG
  5. Rebase your commits
  6. Overwrite your branch with your newly signed commits

There's a lot to unpack, so we're going to need six steps. Also, these instructions are for macOS; Windows and Linux users may have different commands.

Read more on WebDevStudios.com »

Evan Hildreth @oddevan