How do I sign my git commits? #3

Closed
opened 2025-12-30 12:43:57 +00:00 by jadudm · 1 comment
Owner

I want to generate a GPG key and sign my commits, but I never remember how.

I want to generate a GPG key and sign my commits, but I never remember how.
Author
Owner

Github and other sites around the net have good info on this.

generate a key

gpg --full-generate-key

get the key id

gpg --list-secret-keys --keyid-format=long

armor it

gpg --armor --export 3AA5C34371567BD2

and paste that into your GH account.

If the email address does not match an email address on the account, you may need to take extra steps.

tell git about the key

Get the key ID

gpg --list-secret-keys --keyid-format=long

and with the ID:

git config --global user.signingkey <id>

tell git to sign by default

If you want all commits signed:

git config --global commit.gpgsign true
git config --global tag.gpgSign true

or, you can do it one-by-one:

git commit -S -m "YOUR_COMMIT_MESSAGE"
Github and other sites around the net have good info on this. * https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key * https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key * https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits ### generate a key ``` gpg --full-generate-key ``` ### get the key id ``` gpg --list-secret-keys --keyid-format=long ``` ### armor it ``` gpg --armor --export 3AA5C34371567BD2 ``` and paste that into your GH account. If the email address does not match an email address on the account, you may need to take extra steps. ### tell git about the key Get the key ID ``` gpg --list-secret-keys --keyid-format=long ``` and with the ID: ``` git config --global user.signingkey <id> ``` ### tell git to sign by default If you want all commits signed: ``` git config --global commit.gpgsign true git config --global tag.gpgSign true ``` or, you can do it one-by-one: ``` git commit -S -m "YOUR_COMMIT_MESSAGE" ```
jadudm added the git label 2025-12-30 12:51:08 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jadudm/how-to-do-computer-things#3