Skip to content

Instantly share code, notes, and snippets.

@takayukioda
Last active April 21, 2021 13:21
Show Gist options
  • Select an option

  • Save takayukioda/f1a28a6ddc8514b366fd950d171c9c9f to your computer and use it in GitHub Desktop.

Select an option

Save takayukioda/f1a28a6ddc8514b366fd950d171c9c9f to your computer and use it in GitHub Desktop.
Steps to sign commit with GPG

For macOS

$ gpg --armor --export ${KEY_ID} | pbcopy

For macOS

# Install requirements
$ brew install gnupg pinentry-mac

# Generate GPG key
$ gpg --full-gen-key

# Check generated key and its ID
$ gpg --list-keys

# Configure git to use generated GPG
$ git config --global gpg.program gpg
$ git config --global user.signingkey ${KEY_ID}

# Use `pinentry-mac` to enter password
$ echo "pinentry-program /usr/local/bin/pinentry-mac" > ~/.gnupg/gpg-agent.conf

# Restart gpg-agent to apply pinentry program
$ gpgconf --kill gpg-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment