Generating GPG key
gpg --full-generate-key
Choose default RSA, set to 4096.
Setting git local repo config
gpg --list-secret-keys --keyid-format LONG
Output: sec rsa4096/<KEY ID> 2019-12-28 [SC] ...
<KEY ID>
is the identifier of your key.
git config commit.gpgsign true
git config user.signingkey <KEY ID>
If you want to set as global, then use --global
flag in git commands: git config --global commit.gpgsign true && git config --global user.signingkey <KEY ID>
Setting up on GitHub
Before you start, read the notice: Before generating a new GPG key, make sure you've verified your email address.
Create a pubkey export: gpg --armor --export <KEY ID>
Go to: https://github.com/settings/keys
Click on New GPG key
button.
Copy th whole text with start line (-----BEGIN PGP PUBLIC KEY BLOCK-----) and last line (-----END PGP PUBLIC KEY BLOCK-----).
Click on Add GPG key
button.
First commit
git commit -S -m "your commit message"
Checking: after git push
go to the github repo, and click on ... commits
link.
You will see the Verified
badge on the last commit. Click on this badge, you will see more information.