error: gpg failed to sign the data — fatal: failed to write commit object
Commit signing is enabled but GPG couldn’t sign — no TTY for the passphrase, wrong key, or agent not running.
Seen on:
Git
Meaning
commit.gpgsign=true requires a working gpg setup. GUIs and IDEs can’t prompt for the passphrase without pinentry configured.
Common causes
- GPG_TTY not set / pinentry missing
- Key expired or not in the keyring
- user.signingkey wrong
⚡ Quick fix
- export GPG_TTY=$(tty) (add to your shell profile)
- Check keys: gpg --list-secret-keys --keyid-format=long
- Or sign with SSH keys (gpg.format ssh)
Detailed fix by platform
Git
git config --global gpg.format ssh && git config --global user.signingkey ~/.ssh/id_ed25519.pub
How to diagnose
- Test — echo test | gpg --clearsign
- Key — Matches user.signingkey?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026