Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git error: gpg failed to sign the data on Linux

Tags:

git

linux

sign

I am having trouble signing commits. With the following git config:

user.name=Bob
user.email=[bob's email]
user.signingkey=ABCDEFGH
user.user=bob1
gpg.program=gpg2

I was told to include only the first eight characters of the secret key.

After staging, upon git commit -S -m "commit message", I receive the following errors:

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

It seems that most users who encounter this error are on Macs and have some extra setup to do. But I'm on Kali Linux.

Any advice?

like image 643
pmcg521 Avatar asked Oct 15 '18 00:10

pmcg521


People also ask

How do I disable GPG?

You can disable this by running git config commit. gpgsign false This sets the configuration locally instead of globally.


1 Answers

I was told to include only the first eight characters of the secret key.

The value of user.signingkey is a key id identifying which key git should use when generating the signature.

There's a complete example in the official documentation that shows how this should work. If gpg --list-keys shows something like:

/Users/schacon/.gnupg/pubring.gpg
---------------------------------
pub   2048R/0A46826A 2014-06-04
uid                  Scott Chacon (Git signing key) <[email protected]>
sub   2048R/874529A9 2014-06-04

Then the key id is 0A46826A:

git config --global user.signingkey 0A46826A
like image 107
larsks Avatar answered Sep 23 '22 16:09

larsks