Create a GPG Key to sign git commits
- create gpg key:
gpg --full-generate-key
- press enter to choose default setting
-
set bitsize to 4096 and enter further information
-
list all keys to get id of the new one
gpg --list-secret-keys --keyid-format LONG
-
and export with:
gpg --armor --export $KEY_ID
push signing key to yubikey
-
backup secret key first:
gpg --export-secret-key $KEY_ID > signing_key.asc
-
then edit it
gpg --edit-key $KEY_ID
- move it to yubikey with
keytocard
- select the
signing
option
- move it to yubikey with
sign git commit
-
configure git to use the key
git config --global user.signingkey $KEY_ID
-
sign a commit with
git commit -S -m "commit message"