Setup Github GPG key on Macbook (Mac OS)
Symbols count in article:
162
Reading time:
1 mins.
Create gpg key
- Install gpg command.
- Create gpg key and keep press enter to use the default setting. In the last step, set up a paraphrase(password).
- Check your gpg key.
gpg --list-secret-keys --keyid-format=long
- Copy the
A111111111A11A11
part.
- Example:
ed25519/A111111111A11A11
- Export gpg key.
gpg --armor --export A111111111A11A11
Setup gpg in Github
- Setting -> SSH and GPG keys -> New GPG key.
- Paste the export from the previous step.
Git setting
- Tell git your sign key.
git config --global user.signingkey A111111111A11A11
- Force git to sign commits.
git config --global commit.gpgsign true
- Install gpgtools to save the paraphrase.
brew install --cask gpg-suite
Setup gpg variables
- Edit config file.
sudo vim ~/.zshrc
- Add
export GPG_TTY=$(tty)
to the end of file.
- Update config file.
Setup gpg timeout
sudo vim ~/.gnupg/gpg-agent.conf
1 2
| default-cache-ttl 34560000 max-cache-ttl 34560000
|
Sign commit
git commit -s -m 'your commit'