- You have an account on Github already ? If not ceate one.
- Install required tools
# Ubuntu
sudo apt-get install gpa seahorse
# Mac
brew install gpg
- Generate a new gpg key
gpg --gen-key
- Answer the question asked
Note: When asked to enter your email address, ensure that you enter the verified email address for your GitHub account.
- List generated key
gpg --list-secret-keys --keyid-format LONG
- Above command should return like this
/home/username/.gnupg/secring.gpg
-------------------------------
sec 4096R/<COPY_THIS_KEY> 2016-08-11 [expires: 2018-08-11]
uid User Name <[email protected]>
ssb 4096R/62E5B29EEA7145E 2016-08-11
- Note down your key
COPY_THIS_KEYfrom above - Export this key
gpg --armor --export <PASTE_KEY_HERE> > gpg-key.txt
-
Above command will create a new txt file
gpg-key.txt -
Tell git to auto sign your future commits
git config --global user.signingkey <KEY_HERE>
git config --global commit.gpgsign true
git config --global tag.gpgsign true