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)
-
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).
-
Check that your git user is the one you want to sign with
git config user.email- Configure signing commits in git, where path_to_ssh is something like
/Users/szaiats/.ssh/id_ed25519.pub
git config --global gpg.format sshgit config --global user.signingkey <path_to_ssh>git config --global commit.gpgsign true- Configure allowed signers - put there your information
"{email} namespace=git {ssh key}", for example:
touch ~/.config/git/allowed_signersgit config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signersecho "svetzayats@gmail.com namespaces=\"git\" /Users/szaiats/.ssh/id_ed25519.pub" >> ~/.config/git/allowed_signers- 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:
git commit -S -m "My signed commit"- Verify that everything works
git log --show-signature -1This 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