1

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 :

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]
Hadock
  • 796
  • 1
  • 12
  • 28
  • `cannot run gpg2: No such file or directory` suggests that your `git commit` runs (however you run them) are using a different `$PATH` than you are at your shell prompt. Make sure your dot files (.bashrc, .profile, etc) are not doing anything wrong/weird... – torek Sep 28 '20 at 21:46
  • @torek indeed it seems to be that, I tested from a command console and I have the gpg window which asks me for a password – Hadock Sep 29 '20 at 07:06

0 Answers0