Follow: https://help.github.com/articles/generating-a-new-gpg-key/
- Generate a new key
gpg --full-generate-key
- List keys
gpg --list-secret-keys --keyid-format LONG
Follow: https://help.github.com/articles/adding-a-new-gpg-key-to-your-github-account/ and https://help.github.com/articles/associating-an-email-with-your-gpg-key/
- Go to your GitHub settings and add your GPG key
gpg --armor --export XXXXXXX
-
Set the gpg key used by git Follow: https://help.github.com/articles/telling-git-about-your-gpg-key/
git config --global user.signingkey XXXXXXX
-
Activate sign commit on all commits Follow: https://help.github.com/articles/signing-commits-using-gpg/
git config --global commit.gpgsign true
-
Fix gpg path on windows
git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe"
-
Export the key
gpg --list-secret-keys
gpg --export --armor XXXXXXX > key.asc
gpg --export-secret-keys --armor XXXXXXX >> key.asc
gpg --export-ownertrust > ownertrust-gpg.txt
-
Copy the file on any device needed (careful, it's sensitive data)
-
Import the key:
gpg --import key.asc
gpg --import-ownertrust ownertrust-gpg.txt