Use GPG keys
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
Last updated
Was this helpful?
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
Last updated
Was this helpful?
You will be asked for your name and email address. Note that the email address will be public, so use a masked email which both Github () and Gitlab () provides.
Use cases: 1.
This method assumes that you would like to sign commits for only one repository
Step 1. The local Git configuration for a repository should be at .git/config
, open it up and add:
You're done.
This method assumes that you'd only like to generate one key and use them to sign ALL commits.
Step 1. Find the root .gitconfig
by running:
The root
.gitconfig
is typically at${HOME}/.gitconfig
Step 2. In the .gitconfig
, add the following:
includeIf
directiveThis 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.
Login to Gitlab and visit . Run the steps in and paste the exported public key block in.
Login to Github and visit . Run the steps in and paste the exported public key block in.
Replace the signingkey
value with the desired key ID from the output of the .
Replace the signingkey
value with the desired key ID from the output of the .
Replace the signingkey
value with the desired key ID from the output of the .