Edit ---
Like Torek said it seems that the problem comes from an incorrectly configured path on my phpstorm (it works when I commit directly to my console). I tried to add path in the corresponding menu (eg.: gpg2 in path /usr/bin/gpg2
) But that doesn't change anything ... I keep looking.
Question ---
I have this error which i commit some file :
16:11 Commit failed with error
0 file committed, 1 file failed to commit: add readme
gpg failed to sign the data
failed to write commit object
or, if i use git config --global gpg.program gpg2
:
16:25 Commit failed with error
0 file committed, 1 file failed to commit: add readme
cannot run gpg2: No such file or directory
gpg failed to sign the data
failed to write commit object
If i test the gpg2 signature with echo "test" | gpg2 --clearsign
, i have this result :
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
-----BEGIN PGP SIGNATURE-----
123412341231234123412312341234123123412341231234123412312341234123
123412341231234123412312341234123123412341231234123412312341234123
123412341231234123412312341234123123412341231234123412312341234123
123412341231234123412312341234123123412341231234123412312341234123
1234123412312341234123==
=UXT0
-----END PGP SIGNATURE-----
I try to follow this solution (among others) but nothing work :
- gpg failed to sign the data fatal: failed to write commit object [Git 2.10.0]
- Git error - gpg failed to sign data
- https://removeif.github.io/develop/github-gpg-failed-to-sign-the-data.html
My key look like that :
➜ gpg2 -K --keyid-format SHORT
/home/hadock/.gnupg/pubring.kbx
-------------------------------
sec rsa3072/11224455 2020-09-28 [SC] [expires: 2022-09-28]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid [ultimate] Jon Doe <jondoe@gmail.com>
ssb rsa3072/87654321 2020-09-28 [E] [expires: 2022-09-28]
and my git config :
➜ git config --global gpg.program
gpg2
➜ git config --global commit.gpgsign
true
➜ git config --global user.signingkey
11224455
I created my key as this page suggests but i don't have the same result with gpg --list-keys
:
- their display
$ gpg --list-keys
/Users/schacon/.gnupg/pubring.gpg
---------------------------------
pub 2048R/0A46826A 2014-06-04
uid Scott Chacon (Git signing key) <schacon@gmail.com>
sub 2048R/874529A9 2014-06-04
- my display
➜ gpg --list-keys
/home/hadock/.gnupg/pubring.kbx
-------------------------------
pub rsa3072 2020-09-28 [SC] [expires: 2022-09-28]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid [ultimate] Jon Doe <jondoe@gmail.com>
sub rsa3072 2020-09-28 [E] [expires: 2022-09-28]