Command Palette

Quick search articles, topics, and actions

Snippet.
bash17 lines
H A R S H H A A

Fix "gpg failed to sign the data" after GPG key update

The classic macOS GnuPG pinentry die-off that silently breaks every commit.

Source.
bash
# Find the exact signing key Git is using
git config --get user.signingkey

# Reload the agent and restart pinentry
gpgconf --kill gpg-agent
gpgconf --launch gpg-agent

# Make sure the secret key is actually present
gpg --list-secret-keys --keyid-format=long

# Test signature in-place
echo "test" | gpg --clearsign

# If pinentry is missing on macOS:
brew install pinentry-mac
echo "pinentry-program /opt/homebrew/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
gpgconf --kill gpg-agent
Zero-friction retrieval.
Pipe it straight into your shell
$ curl -fsSL https://blog.harshhaareddy.com/raw/m1crtnmj3a9z7yt0iho99e02 | bash

Pipes the raw source straight into your shell. Review the raw output first if you are cautious.

Fix "gpg failed to sign the data" after GPG key update | DevOps, Cloud & AI Space