Sign Git Commit with Yubikey
02-03-2020
Language or Platform: Markup
Code:
List the private key:
gpg --list-secret-keys --keyid-format LONG <email or name>
Grab the ID next your Signing Key:
ssb> rsa4096/BZ245BF5756C03DE 2020-01-18 [S] gives you...
BZ245BF5756C03DE
Tell Git to use that key to sign the commits:
git config --global user.signingkey BZ245BF5756C03DE
Sign git commit with -S option:
git commit -S -m "My commit msg"
Your Yubikey will need to be inserted to sign commits!
If you want to permanently add the -S option to your commit, use this command:
git config --global commit.gpgsign true
Check that a commit is signed:
git log --oneline --show-signature
Back