Install gnupg and pinentry-mac
brew install gnupg
brew install pinentry-mac
Generating a GPG key
Generating key
gpg --full-generate-key
Checking the key
gpg --list-secret-keys --keyid-format LONG
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid Hubot
ssb 4096R/42B317FD4BA89E7A 2016-03-10
Copying the key
In this example, the GPG key ID is 3AA5C34371567BD2
gpg --armor --export 3AA5C34371567BD2 | pbcopy
Load the key for git
vim .gnupg/gpg-agent.conf
add the line
pinentry-program /usr/local/bin/pinentry-mac
Backup and restore
gpg --export-secret-keys KEY_ID > my-private-key.asc
gpg --import my-private-key.asc
Top comments (0)