This content originally appeared on DEV Community and was authored by Soham Zemse
Install
brew install gpg
Create new key
gpg --full-generate-key
Setup keychain
gpg collects password from cli. This causes issues if using vscode to create a commit. So input can be taken from a popup or keychain.
brew install pinentry-mac
The brew installation will print these caveats:
==> Caveats
You can now set this as your pinentry program like
~/.gnupg/gpg-agent.conf
pinentry-program /opt/homebrew/bin/pinentry-mac
So just create a ~/.gnupg/gpg-agent.conf
file if it doesn't exist and put the line pinentry-program /opt/homebrew/bin/pinentry-mac
in it.
Now, to check if it works.
1.gpg --list-keys
to print the existing keys.
-
pkill -TERM gpg-agent
. - Restart the terminal.
echo test | gpg -e -r <PUT THE KEY ID HERE> | gpg -d
This should open a pin entry popup and make sure "save in keychain" option is selected.
More links
Documentation on GitHub for setup: https://docs.github.com/en/authentication/managing-commit-signature-verification
This content originally appeared on DEV Community and was authored by Soham Zemse
Soham Zemse | Sciencx (2023-03-12T14:07:08+00:00) Setup GPG on macOS. Retrieved from https://www.scien.cx/2023/03/12/setup-gpg-on-macos/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.