5 function __git_gpg_init() {
6 export PATH="$HOME/.local/opt/gnupg/bin:$PATH"
7 export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH"
9 # TODO check for public key without gpg-pubkey?
10 if ! command -v gpg-pubkey; then
20 echo -n "Enabling automatic git commit signing...
21 git config --global user.signingkey ${MY_KEY_ID}
22 git config --global commit.gpgsign true
23 git config --global log.showSignature true
26 git config --global user.signingkey "${MY_KEY_ID}"
27 git config --global commit.gpgsign true
28 git config --global log.showSignature true
31 echo "Successfully updated ~/.gitconfig"
33 echo "How to verify signed commits on GitHub:"
35 echo " 1. Go to 'Add GPG Key': https://github.com/settings/gpg/new"
36 echo " 2. Copy and paste the key above from the first ---- to the last ----"