Skip to content

Instantly share code, notes, and snippets.

@peterroth
Last active August 25, 2020 10:01
Show Gist options
  • Save peterroth/0d500d74d54c018b4b514b939b11ca26 to your computer and use it in GitHub Desktop.
Save peterroth/0d500d74d54c018b4b514b939b11ca26 to your computer and use it in GitHub Desktop.

Signing commits on GitHub

Creating the PGP key

Create key. There are plenty of how-tos on internet
gpg --list-secret-keys --keyid-format LONG
gpg --armor --export <ID>
Add on github.com

Configure the client on the machine:

git config --global commit.gpgsign true
git config --global user.signingkey <ID>
git config --global gpg.program <gpg|gpg2>

Optional, but recommended:

git config --global user.name "<name>"
git config --global user.email "<main e-mail address in GPG key>"
Add to shell profile:
alias gcsm="git commit -S -m"

If singning fails

with the below error:

error: gpg failed to sign the data
fatal: failed to write commit object
The first command you need to run: gpgconf --kill scdaemon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment