I have recently tried the Windows Subsystem for Linux lately and as I was attempting to sign my git commits with a recently generated GPG key it spewed out,
verticalfile30@DESKTOP-U284V9I:~/cpo/wsltest$ git commit -S -m "gpg signing"
error: gpg failed to sign the data
fatal: failed to write commit object
I have used git long enough to know that I have to set the local or global variables on git to use my GPG key.
After the first error, I tried to generate another key but that also did not work, including the subkeys.
My GPGs were encrypted in RSA and RSA (default).
I have tried using articles on help.github.com but to no avail.
(Here are some specific sources.) https://help.github.com/en/articles/telling-git-about-your-signing-key
https://help.github.com/en/articles/signing-commits
Here is most of the terminal log
verticalfile30@DESKTOP-U284V9I:~/cpo/wsltest$ git config --global commit.gpgsign true
verticalfile30@DESKTOP-U284V9I:~/cpo/wsltest$ gpg2 --list-secret-keys --keyid-format LONG
gpg: checking the trustdb
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u
gpg: next trustdb check due at 2021-08-22
/home/verticalfile30/.gnupg/pubring.kbx
---------------------------------------
sec rsa4096/498F47808959B459 2019-08-23 [SC] [expires: 2021-08-22]
A533C851D2905FC63C161831498F47808959B459
uid [ultimate] Vert Simon (Key#3) <[email protected]>
ssb rsa4096/E4E65BE559FFBE2C 2019-08-23 [E] [expires: 2021-08-22]
sec rsa4096/B3C88EE54DC15CC9 2019-08-23 [SC]
87F5399E6BFEF88C1C64794CB3C88EE54DC15CC9
uid [ultimate] Vert S (Sop) <[email protected]>
ssb rsa4096/E868623210106F9D 2019-08-23 [E]
verticalfile30@DESKTOP-U284V9I:~/cpo/wsltest$ git config --global user.signingkey E868623210106F9D
verticalfile30@DESKTOP-U284V9I:~/cpo/wsltest$ git commit -S -m "gpg signing"
error: gpg failed to sign the data
fatal: failed to write commit object
verticalfile30@DESKTOP-U284V9I:~/cpo/wsltest$ git config --global user.signingkey B3C88EE54DC15CC9
verticalfile30@DESKTOP-U284V9I:~/cpo/wsltest$ git commit -S -m "gpg signing"
error: gpg failed to sign the data
fatal: failed to write commit object
Many sources online, as well as other questions on Stack Overflow, ended up saying the same thing, set the global variables. Is there something I am forgetting or getting wrong? Thanks.
Introduction. GPG, or GNU Privacy Guard, is a public key cryptography implementation. This allows for the secure transmission of information between parties and can be used to verify that the origin of a message is genuine.
That was followed in microsoft/WSL issue 4029
But in that case, it was:
My key has a passphrase but there is no prompt to enter the passphrase.
But then I read this:
Step 3 is
export GPG_TTY=$(tty)
, which sends the prompt to tty.
After entering my passphrase, everything works.
Example: danhorst/dotfiles
commit 805a779, which follows gpg failed to sign the data fatal: failed to write commit object [Git 2.10.0].
Follow the below url to setup signed commit https://help.github.com/en/articles/telling-git-about-your-signing-key
if still getting gpg failed to sign the data fatal: failed to write commit object
this is not issue with git ,this is with GPG follow below steps
gpg --version
echo "test" | gpg --clearsign
if it is showing:
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
then use export GPG_TTY=$(tty)
then try again echo "test" | gpg --clearsign
in which PGP signature is.
Output:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
-----BEGIN PGP SIGNATURE-----
iLMEAQEKAB0WIQS2V0SFHi18psvDbo7uFF+LP7qc1gUCYLjB2QAKCRDuFF+LP7qc
1r5LBACB1m3Lpl21379qAvVamWcn9isdgdg34t34t43t34t34t434yGQHqikxWL7A5
Ls7giKZYscb30o0rkY6I1W9MjBBW96R2pnaYsioFpsf434dfg54rfdgfdgdfgdfpaIoU3k
JKrYxR7yMjqUv0a2jE+97kh+bSuzqwIkMHyikbABI90lY+4OLw==
=UHKx
-----END PGP SIGNATURE-----
git config -l | grep gpg
Output:
commit.gpgsign=true
gpg.program=gpg
tag.gpgsign=true
git config --global commit.gpgsign true
gpg failed to sign the data fatal: failed to write commit object [Git 2.10.0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With