Перейти к содержимому

github

1 post with the tag “github”

Sign here please!

In December my working laptop decided to add some fun to my life, and for whatever reason my commits stopped being signed by me. I discovered it when I tried to merge approved PR for new feature, and Github didn’t allow me to do it.

It’s always confusing when everything worked fine 2 hours ago, you didn’t do anything related to git or configuration of system/IDE — and somehow world changed and now you need to fix it. It’s part of software engineering that I enjoy whenever.

How to start signing commits again (for Github)

  1. Check if you have generated ssh key in your Github account (if you don’t have one — use Github documentation for generating a new one).

  2. Check that your git user is the one you want to sign with

Terminal window
git config user.email
  1. Configure signing commits in git, where path_to_ssh is something like /Users/szaiats/.ssh/id_ed25519.pub
Terminal window
git config --global gpg.format ssh
git config --global user.signingkey <path_to_ssh>
git config --global commit.gpgsign true
  1. Configure allowed signers - put there your information "{email} namespace=git {ssh key}", for example:
Terminal window
touch ~/.config/git/allowed_signers
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signers
echo "svetzayats@gmail.com namespaces=\"git\" /Users/szaiats/.ssh/id_ed25519.pub" >> ~/.config/git/allowed_signers
  1. Check settings of your IDE. I use vscode and I needed to “Enable Commit Signing” to make signed commits from UI; otherwise I need always commit with -S flag:
Terminal window
git commit -S -m "My signed commit"
  1. Verify that everything works
Terminal window
git log --show-signature -1

This one, by the way, helps a lot in debugging why a commit might not be signed. It shows information about problems if there are any.

Also you can check signature verification status on Github — in commits section