gpg: signing failed: Bad secret key

Leo Coogan leocoogan at mailfence.com
Fri Jan 19 20:19:40 CET 2024


When I run `git commit -m` on nixos, I receive this error:

```

error: gpg failed to sign the data:
[GNUPG:] KEY_CONSIDERED C0156FFBE02B4E03F7792EB53D7F617CDE5C9A9B 2
[GNUPG:] BEGIN_SIGNING H10
gpg: signing failed: Bad secret key
[GNUPG:] FAILURE sign 67108871
gpg: signing failed: Bad secret key

fatal: failed to write commit object

```

Here's my git config:

```
[user]
	email =leocoogan at existential.beauty
	name = Leo Coogan
	signingkey = C0156FFBE02B4E03F7792EB53D7F617CDE5C9A9B
	#signingkey = 3D7F617CDE5C9A9B

[commit]
	gpgsign = true

```

And here's `gpg -k`:
```
/home/lcoogan/.gnupg/pubring.kbx
--------------------------------
pub   ed25519 2023-03-03 [SC] [expires: 2025-03-02]
       C0156FFBE02B4E03F7792EB53D7F617CDE5C9A9B
uid           [ultimate] Leo Coogan (Personal)<leocoogan at existential.beauty>
uid           [ultimate] Leo Coogan (Personal GPG key)<leocoogan at mailfence.com>
sub   cv25519 2023-03-03 [E] [expires: 2025-03-02]

```

The same error happens when I write to a file with `pass`:
```
> pass insert test
An entry already exists for test. Overwrite it? [y/N] y
Enter password for test:
Retype password for test:
error: gpg failed to sign the data:
[GNUPG:] KEY_CONSIDERED C0156FFBE02B4E03F7792EB53D7F617CDE5C9A9B 2
[GNUPG:] BEGIN_SIGNING H10
gpg: signing failed: Bad secret key
[GNUPG:] FAILURE sign 67108871
gpg: signing failed: Bad secret key

fatal: failed to write commit object
```

Really not sure what I'm supposed to do. I looked up the error, but I didn't find any sources that had this exact error, 'bad secret key'.

This only happens on my nixos machine. My other machine I run fedora on has never had signing errors.

Any help, advice, or suggestions would be greatly appreciated. I've had this issue for several months, but I've put it off.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20240119/09e17472/attachment-0001.html>


More information about the Gnupg-users mailing list