`git commit` fails with `error: gpg failed to sign the data` and `fatal: failed to write commit object`.
IntermediateTroubleshootingGitHub, Actions and Pull Request Issues
Answer
Likely causes → commit.gpgsign=true but GPG cannot prompt for the passphrase (no TTY, pinentry missing in a GUI or SSH session), the key expired, or user.signingkey points at a key that does not exist on this machine.
Diagnose →
echo test | gpg --clearsign # shows the real gpg error
gpg --list-secret-keys --keyid-format=long
git config --get user.signingkey
Fix → Set the TTY and restart the agent:
export GPG_TTY=$(tty) # add to ~/.bashrc or ~/.zshrc
gpgconf --kill gpg-agent
On macOS install pinentry-mac and set it in ~/.gnupg/gpg-agent.conf. For an expired key, extend it (gpg --edit-key <id> → expire) and re-upload the public key.
Prevent → Consider SSH signing (gpg.format=ssh), which reuses your SSH agent and avoids pinentry issues.
More on GitHub, Actions and Pull Request Issues
A workflow step that pushes a version bump fails with `remote: Permission to org/repo.git denied to github-actions[bot].` and `The requested URL returned error: 403`.IntermediateA workflow pushes a commit or tag, but the workflow that should run on that push or tag never starts.IntermediateA container job fails on any Git command with `fatal: detected dubious ownership in repository at '/__w/app/app'`.IntermediateYour PR suddenly shows 340 changed files and dozens of commits you did not write.IntermediateThe PR is stuck on `Expected — Waiting for status to be reported` for a required check called `build`.IntermediateThe PR was approved, but merging shows "Review required" again after you pushed a small fix.Beginner