brew install gpg
brew install pinentry-mac
Follow instructions, select default via Enter
if unsure.
gpg --full-generate-key
gpg --list-secret-keys --keyid-format=long
Your <key> is in "sec" part after slash, eg: sec ed25519/HERE 2021-12-07 [SC]
Check where brew is located itself:
which brew
Substitute all /usr/local/bin
locations in the paths below to: /opt/homebrew/bin
.
git config --global user.signingkey <key>
git config --global commit.gpgsign true
git config --global gpg.program /usr/local/bin/gpg
if [ -r ~/.zshrc ]; then echo 'export GPG_TTY=$(tty)' >> ~/.zshrc; \
else echo 'export GPG_TTY=$(tty)' >> ~/.zprofile; fi
echo "pinentry-program /usr/local/bin/pinentry-mac" > ~/.gnupg/gpg-agent.conf
gpgconf --kill gpg-agent
gpg --armor --export <key>
https://github.com/settings/gpg/new
If you are moving your gpg folder (~/.gnupg
) to another machine, make sure to correct permissions afterwards:
chown -R $(whoami) ~/.gnupg/
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
Some tools may be hardcoded to look only in one location, make a symlink:
sudo ln -s /opt/homebrew/bin/gpg /usr/local/bin