pstadler / keybase-gpg-github

Step-by-step guide on how to create a GPG key on keybase.io, adding it to a local GPG setup and using it with Git and GitHub.
2.64k stars 182 forks source link

Error: gpg failed to sign the data #24

Open HofmannZ opened 7 years ago

HofmannZ commented 7 years ago

Hi,

I've followed the exact steps, but when I try to commit I get the following message:

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

I made sure git us using the right PGP program, name and email. All matching the info in my GPG key.

Not quite sure what's going on, any suggestions?

skrulcik commented 7 years ago

Try setting up your TTY, as seen in one of the optional sections of these instructions.

I had this problem as well (OSX 10.13, gpg (GnuPG) 2.2.1), and was able to find the solution in a comment on a related issue on the Keybase issues page. The underlying issue (apparent to me after trying echo "test" | gpg --clearsign) is actually with GPG, not with how Git is using it to sign.

przemyslawpluta commented 6 years ago

Had similar issue and running echo "test" | gpg --clearsign fixed if for a bit after reentering pass again.

trinitronx commented 6 years ago

I've noticed with Yubikey 4 Nano, sometimes scdaemon gets into a borked state. It ends up yielding the same error when using signed commits.

Workaround that seems to fix it temporarily is:

# Kill any and all messed up scdaemon instances
ps auxww | grep -i scdaemon | grep -v grep | awk '{ print $2 }' | xargs kill
# Wait a sec
sleep 1
# Now re-init scdaemon by asking for card status
gpg2 --card-status

After this workaround, it should work again. Hope this helps fellow Yubikey users.

wolfy1339 commented 6 years ago

I had this problem with git (although not with this plugin) and a google search for this problem led me here, with the comments here I got more info on the problem, it turns out there's an issue with keybase for this: keybase/keybase-issues#2798 and it contains a fix that works This problem is not caused by git or anything else but GPG itself

jozefvaclavik commented 6 years ago

gpg --clearsign was working for me in terminal (after setting GPG_TTY), but I still couldn't commit through GUI (Git Tower).

Had to do:

echo no-tty >> ~/.gnupg/gpg.conf
git config --global gpg.program /usr/local/bin/gpg
nmanikumar5 commented 6 years ago

This will help you to get rid of it

git config commit.gpgsign false

jasonzhouu commented 5 years ago

run gpgconf --kill gpg-agent to kill any running agent that might be hung 2016-12 https://stackoverflow.com/a/41054093/7218912

This works for me.