Backup
- Backup Public key to
public_key.asc - Backup Secret key to
secret_key.gpggpg --export-secret-keys YOUR_ID_HERE > secret_key.gpg
- Backup
.gnupg/just in case
gpg-agent.conf
| |
gpg.conf
| |
Restore
After install gpg-suite, simply click the public_key.asc and
secret_key.gpg, it will prompts for password for secret keys.
Simply copy conf files to ~/.gnupg
Motivation
Came across this signing in dotfiles and I would also want to have the verified in each commit I made in my pc so why not?
How-to
- Install GPG Suite as it allows storing in macOS keychain, without typing each time
brew install --cask gpg-suite- Don’t install
gpgorpinentry-macas it might cause conflict and also can not be stored in keychain
- Create a key either from CLI or in GPG Keychain app
- Noted the name and email should be the same as the git configure
- Specify location for git
- In
~/.gitconfig.local: modify as below
- In
- Adding a new GPG key to your GitHub account
| |
Keep your email private
At this point, the emails I used have already been in so many projects and repo and its just a fact that this email is already “exposed”.
You can check, see a post
| |
The things and steps are pretty much just the same as the post but there’s one thing worth mentioning.
In the email setting in Github, a masked email address will be generated with a format: NUMBER+username@github.noreply.github.com. But username@github.noreply.github.com is the one to input in GPG key, the one with a number prefix is not gonna verfy the commits and github will show errors like “No githuub user associated with the email”