Setup GPG for git on macOS

Install gnupg and pinentry-mac

1
2
brew install gnupg
brew install pinentry-mac

Generating a GPG key

Generating key

gpg --full-generate-key

Checking my key

gpg --list-secret-keys --keyid-format LONG

Copying key

gpg --armor --export 3AA5C34371567BD2 | pbcopy

Setting key for git

git config --global user.signingkey 3AA5C34371567BD2

Full help

https://help.github.com/articles/generating-a-new-gpg-key/

Setting to load key

nvim .gnupg/gpg-agent.conf

pinentry-program /usr/local/bin/pinentry-mac

Backup and restore

1
2
gpg --export-secret-keys KEY_ID > my-private-key.asc
gpg --import my-private-key.asc