Skip to content

Latest commit

 

History

History
56 lines (47 loc) · 1.17 KB

gpg.md

File metadata and controls

56 lines (47 loc) · 1.17 KB

GPG key - Verified Git Commits

  1. Get gpg command
brew install gnupg
  1. Generate GPG key
gpg --full-generate-key
  1. List GPG keys for [email protected]
gpg --list-secret-keys --keyid-format LONG [email protected]
  1. Copy the GPG key ID that starts with sec. In the following example, 488652B776349D07:
sec   rsa4096/488652B776349D07 2019-12-14 [SC]
      8AAF3B17369BFB6A36171FFA76349D07488652B7
uid                 [ultimate] Derek Zoladz (None) <[email protected]>
ssb   rsa4096/8A3A7957EECFC9AA 2019-12-14 [E]
  1. Export the public key of that ID
gpg --armor --export 488652B776349D07
  1. Copy the public GPG key and it to both GitLab and GitHub accounts

  2. Tell Git to use your GPG key to sign commits

git config --global user.signingkey 488652B776349D07
  1. Tell Git to sign your commits automatically, to avoid using the -S flag with every commit
git config --global commit.gpgsign true
  1. Export GPG key
# temporary
export GPG_TTY=$(tty)

-or-

# add to .bashrc or .zshrc to load at each session
GPG_TTY=$(tty)
export GPG_TTY