Skip to content

Instantly share code, notes, and snippets.

@mkorkmaz
Last active February 10, 2019 16:28
Show Gist options
  • Save mkorkmaz/900ad9f2957d5b28dbd6b31e183b5b1a to your computer and use it in GitHub Desktop.
Save mkorkmaz/900ad9f2957d5b28dbd6b31e183b5b1a to your computer and use it in GitHub Desktop.
Signing git commits using keybase gpg
# Asuming you have keybase installed and generated a gpg key
keybase pgp export # list your keybase gpg keys
# user: Mehmet Korkmaz <[email protected]>
# 4096-bit RSA key, ID GPG_KEY, created 2019-01-01
keybase pgp export -q GPG_KEY | gpg --import
keybase pgp export -q GPG_KEY --secret --unencrypted| gpg --import --allow-secret-key-import
gpg --list-secret-keys --keyid-format LONG
# /Users/reformo/.gnupg/pubring.kbx
# ---------------------------------
# sec rsa4096/GPG_KEY 2019-01-06 [SC] [expires: 2035-01-02]
# GPG_KEY_LONG
# uid [ unknown] Mehmet Korkmaz <[email protected]>
# ssb rsa4096/GPG_KEY 2019-01-06 [E] [expires: 2035-01-02]
git config --global commit.gpgsign true
git config --global user.signingkey GPG_KEY
git config --global gpg.program $(which gpg)
echo "test" | gpg --clearsign # test gpg sign.
# -----BEGIN PGP SIGNED MESSAGE-----
# Hash: SHA256
#
# test
# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAEBCAAdFiEETJ4C3KaTYHtHDPjOHO1oeOJUedcFAlxgUOsACgkQTO1oeOJU
# edfZ7RAArfc91bG3GxCCBjY5S/IXljcssAt7uJkKSZd9/5LtNIEc41zlryogwM8r
# ER7VtIz+c5vju7hpb95hYeWgkxWLrarxIjn7uFggSo14vnLopmARwNSpHn7Qlo8r
# TUCQTxPfRSM0fU5Dkv/DNna2iC0czOaV0Nope+AyF5fg3bYOSL6VXIYggyzSoN5i
# 2dSagwRAuTlx42Il4zJuQrMQr4WoZ9wg73FOH0PXfoaUOLpmy4bZepYg74embrqL
# 4eUq9XH2tMURQ7KjsLPb/GaBG6JpZu545t5iHrzJccI5qbvPJCtipzt5wTDZ3Tsw
# FU3Jtsb4bXhB9A/CwT/AFrT7dSNdognxoQTillFYlT7iCmT0IsQAOKZ+rHdAZsSj
# 2vF8ZxjYuhFFJV5RG+JxjbG9+kTELashSEh8Y+zCD86UVCjWzHoaf9qQ2Y53w+fF
# I2761tDD2WqUg4BKIMeOIff7G539DynTJaVVXxXIOzaOI6c4vud5u0wbRVqdHlz9
# cPLqsPAbcDe8cV8auLmgLkQDzWMrHJ8N///5casxbEhYgpBTekzXBdTPr3cdpWhD
# KmuIk6XcG6Jl3Qr7ZsYXtBAphSDnwmVBcmrIAugivTFt82ye3Y4lq8mMLQOEbVZD
# RZchTyEwPaR61A5E6QqM608tbAiMlt9cpYFLjKu94khT3q5SiK8=
# =YPYS
# -----END PGP SIGNATURE-----
echo no-tty >> ~/.gnupg/gpg.conf # use git gui clients like git-tower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment