This is how you sign your Git commits on macOS).
- Install the GPG Suite (
brew install --cask gpg-suite
) - Open the GPG Keychain application and create a new key with the email address you use for git commits
- Run
git config --global commit.gpgsign true
to enable GPG for all repositories - Run
git config --global gpg.program gpg2
to make sure git usesgpg2
- Copy the Key ID from the Key Details in GPG Keychain
- Run
git config --global user.signingKey <copied key id>
to tell git which key to use - To make sure your git host knows about they key you should upload the public part (GitHub Settings)
This also works with Multiple Gitconfigs, add the signingKey
to your other .gitconfig
and you’re good.