How to Sign Your Commit on Github with SSH key

1. Tell Git to Use SSH for SigningOpen your terminal and configure Git to use SSH as your signature format:

git config --global gpg.format ssh

  1. Find your public SSH key ~/.ssh/id_ed25519.pub or ~/.ssh/id_rsa.pub) and set it as your signing key:
git config --global user.signingkey "~/.ssh/id_ed25519.pub"

3. Enable Automatic Signing

git config --global commit.gpgsign true

4. Add Your Key to GitHub

  1. Copy your public SSH key content to your clipboard.
  2. Go to your GitHub SSH and GPG keys settings.
  3. Click New SSH Key.
  4. Set the Key type dropdown menu to Signing Key (do not leave it as Authentication Key).
  5. Paste your public key into the field and save it.
豫ICP备18015035号-1