Generate GPG key
Visit GnuPG’s Download Page ↗ to install the GPG command line tools. Once installed, check its version using gpg --version.
If the version is 2.1.17 or greater, use the following command:
gpg --full-generate-key
Otherwise, use this command to start the process.
gpg --default-new-key-algo rsa4096 --gen-key
You will be prompted multiple times by the program. Choose the desired option each time and proceed, or simply press Enter to accept the default selection.
Once you have selected all the options, verify the information, and if everything is correct, proceed, and the GPG key will be generated.
Check the key you’ve just created using the following command:
gpg --list-secret-keys --keyid-format=long
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid Hubot <hubot@example.com>
ssb 4096R/4BB6D45482678BE3 2016-03-10
Then if you want, you can use this command to export the GPG key in ASCII-armored format:
gpg --armor --export 3AA5C34371567BD2
You can then use the exported key for various purposes, including adding it to your accounts on platforms like GitHub.