Skip to content

Instantly share code, notes, and snippets.

@VDigitall
Forked from paolocarrasco/README.md
Created March 5, 2021 11:23
Show Gist options
  • Save VDigitall/119129624e4e275fd6a8dba107526f19 to your computer and use it in GitHub Desktop.
Save VDigitall/119129624e4e275fd6a8dba107526f19 to your computer and use it in GitHub Desktop.
How to understand the `gpg failed to sign the data` problem

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

For understanding what's going on, first check what git is doing:

GIT_TRACE=1 git rebase --continue

With that you can see what the problem can be. And what GPG is doing: Probably you will see something like this

10:37:22.346480 run-command.c:637       trace: run_command: gpg --status-fd=2 -bsau <your GPG key>

(Check if your GPG key is correct)

Repeat that gpg command again in the command line:

gpg --status-fd=2 -bsau <your GPG key>

Solutions

We can have many problems, but I list what I found:

  1. It could be that the GPG key was expired: https://stackoverflow.com/a/47561300/532912
  2. Another thing could be that the secret key was not set (the message says gpg: signing failed: No secret key). It means that is not finding the key that was set (it happened to me because I preppended a number).

Hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment