Skip to content

Instantly share code, notes, and snippets.

@jesusgoku
Last active March 31, 2020 07:29
Show Gist options
  • Save jesusgoku/70d7b29b6b75577f9860a5c49413ab42 to your computer and use it in GitHub Desktop.
Save jesusgoku/70d7b29b6b75577f9860a5c49413ab42 to your computer and use it in GitHub Desktop.
Git: sign commits

Git Sign Commit

Testing sign git commits

Requirements

Setting macOS environment

# Install GNUPG and Pinentry for mac
brew install gnupg pinentry-mac

# Setting GPG agent pinentry
echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf

# Kill GPG agent for load new setting
killall gpg-agent

Generate GPG key

# Generate key
gpg --full-gen-key

# Obtain your secret key ID
gpg --list-secret-keys --keyid-format LONG

# sec   rsa4096/8183603BEE944101 2020-03-25 [SC]
#       CE33D90B0DDF1ED94580D9D18183603BEE944101
# uid                 [ultimate] Name Lastname (Comment) <[email protected]>
# ssb   rsa4096/F7377784E8884378 2020-03-25 [E]

# Your key ID is: sec rsa4096/[YOUR KEY ID] 2020-03-25 [SC]

Setting Git

git config --global gpg.program gpg
git config --global commit.gpgsign true

git config --global user.name 'Name Lastname'
git config --global user.email '[email protected]'
git config --global user.signingkey '8183603BEE944101'

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment