This page describes setting up identification details which can be used to verify code was written by you or software was released by you. GPG keys are used to sign code commits or code releases
Generating a new key
Generating a new key with Ubuntu
# on 18.04
gpg --full-gen-key;
# on 16.04/macOS
gpg --gen-key;
This method assumes you have a local directory structure that mimics the SCM platform you're using. For example, a repository at https://github.com/zephinzer/wiki.joeir.net should be located at ${HOME}/github.com/zephinzer/wiki.joeir.net or ${HOME}/code/github.com/zephinzer/wiki.joeir.net
Step 1. Find the root .gitconfig by running:
The root .gitconfig is typically at ${HOME}/.gitconfig
Step 2. In the root .gitconfig, add the directive:
Step 3. Then create the file at ~/.github.com.gitconfig with the following content:
Step 4. Repeat steps 2-3 for as many SCM platforms as you are using
Note that if you, like me commit your dotfiles to a public repository for others to copy/paste as needed, it might be useful to use the include directive to include a path that isn't committed to your dotfiles such as:
You can chain other includeIf directives from your ~/.gitconfig.d file as needed to SCM platforms whose URLs are better left out of the public eye.
# copy and paste the key id from above to generate the public key
gpg --armor --export C4CC3911D49AB2D8
# example output:
# -----BEGIN PGP PUBLIC KEY BLOCK-----
# ...
# -----END PGP PUBLIC KEY BLOCK-----
[user]
name = your name
email = [email protected] signingkey = XXXXXXXXXXXXXXXX
git config --global --list --show-origin
[user]
name = your name
email = [email protected] signingkey = XXXXXXXXXXXXXXXX