Skip to content

Instantly share code, notes, and snippets.

@asears
Forked from alopresto/gpg_git_signing.md
Last active April 9, 2020 11:23
Show Gist options
  • Select an option

  • Save asears/2e609ad9bae913b6f6472b5c6b29b13f to your computer and use it in GitHub Desktop.

Select an option

Save asears/2e609ad9bae913b6f6472b5c6b29b13f to your computer and use it in GitHub Desktop.
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  2. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  3. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  4. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  5. $ echo "Some content" >> example.txt
  6. $ git add example.txt
  7. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
  8. $ git logs

Resources

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