- Generate SSH Key (though existing one can be used also)
ssh-keygen -t ed25519 -C "1190812+alexgalkin@users.noreply.github.com" -f ~/.ssh/github_signing_key
- View and copy the full public key and add it to your GitHub profile as a Signing key
cat ~/.ssh/github_signing_key.pub
- Configure your new key for signing using git
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/github_signing_key.pub
- And when you do commits use
-Sparameter
git commit -S -m "fix: resolved the issue with keys signing"
- Let Git verify those signatures locally by listing your email and public key as an allowed signer
mkdir -p ~/.config/git
echo "$(git config user.email) $(cat ~/.ssh/github_signing_key.pub)" > ~/.config/git/allowed_signers
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signers
- Sign every commit by default, and show the signature status in
git log
git config --global commit.gpgsign true
git config --global log.showSignature true
Useful references: