gpg failed to write commit object

I created a post on stackoverflow regarding an issue with git and gpg. Looks like this is coming from the paths in phpstorm because everything works when I commit directly to my console.

 

The error I got is as follows:

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

 

I add the path in the setting but nothing works :

 

5 comments
Comment actions Permalink

or, if i use git config --global gpg.program gpg2

Why not use the full path to gpg2 here?

0
Comment actions Permalink

I forgot to specify it but I have the same error with :

➜ git config --global gpg.program /usr/bin/gpg2

what i don't understand is that everything looks ok when i commit on the console (and i use gpg.program gpg) but nothing works when i use phpstorm

0
Comment actions Permalink

I forgot to specify it but I have the same error with :
➜ git config --global gpg.program /usr/bin/gpg2

Does it say cannot run /usr/bin/gpg2?

what i don't understand is that everything looks ok when i commit on the console (and i use gpg.program gpg) but nothing works when i use phpstorm

Because GUI applications have a different set of environment variables configured for them, compared to console ones, including a different $PATH variable.

0
Comment actions Permalink

with /usr/bin/gpg2 he says "/usr/bin/gpg2 not found", but i test with "gpg.program gpg" directly in the console and everything works. So i think it's a problem with the path like you said. 

I put the following parameter in the "path" setting but nothing change :

0
Comment actions Permalink

@Alan Bouteiller

FYI: "Settings/Preferences | Appearance & Behavior | Path Variables" have nothing to do with detecting program paths or stuff like that. It is about how to store paths in config files to accommodate cases where the same tool/library can be located in different places/paths on different computers.

https://www.jetbrains.com/help/phpstorm/2020.2/absolute-path-variables.html

 

In you case you need something like https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000809520/comments/360000141219 or https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000112490/comments/115000143610 -- something among those lines I believe.

0

Please sign in to leave a comment.