Skip to content

GPG Singing and SSH Signing

SuperBo edited this page May 25, 2024 · 5 revisions

In order to sign commit with git, you have 2 options, using GPG key and SSH key.

🔑 SSH Key signing

Ensure you have OpenSSH installed. Then configure your repo as following.

git config commit.gpgsign true
git config gpg.format ssh
# you must set signingkey for ssh signing to work.
git config user.signingkey ~/.ssh/id_ed25519.pub 

Install openssh guide

  • Arch Linux: sudo pacman -S openssh
  • Ubuntu: sudo apt-get install openssh-client
  • Fedora: sudo dnf install openssh-clients
  • Mac: brew install openssh

🔑 GPG Key signing

Ensure you have GPGme installed. And install a GUI pinentry program, so that it doesn't clear terminal buffer of Neovim GUI. Then configure your repo as folowing

git config commit.gpgsign true
# reset gpg format
git config --unset gpg.format
# Optionally set your gpg key
git config user.signingkey "KeyID"

Install GPGMe guide

Arch Linux

sudo pacman -S gpgme

MacOS

brew install gpgme pinentry-mac
# Set Pinentry
echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf

Ubuntu/Debian

sudo apt-get install libgpgme11

Windows

Download and install GPG4Win