A
A
Anatoly Soldatov2021-10-07 13:44:22
git
Anatoly Soldatov, 2021-10-07 13:44:22

PhpStorm can't sign git commit. Why?

Commits are signed by gpg. When trying to make a commit (or a merge commit, as in the screenshot) using the gui in PhpStorm, an error occurs:
615eca24412a3842896693.png


gpg failed to sign the data
failed to write commit object


In PhpStorm logs:

2021-10-07 12:32:35,737 [8688771] INFO - 4idea.branch.GitMergeOperation - starting
2021-10-07 12:32:35,737 [8688771] INFO - 4idea.branch.GitMergeOperation - next repository: \\wsl$ \Ubuntu-20.04\home\user\projects\*************hid**********
2021-10-07 12:32:35,797 [8688831] INFO - #git4idea.commands .GitHandler - [***********hid**********] git -c core.quotepath=false -c log.showSignature=false merge master
2021-10-07 12:32 :35,837 [8688871] INFO - #git4idea.commands.GitHandler - error: gpg failed to sign the data
2021-10-07 12:32:35,837 [8688871] INFO - #git4idea.commands.GitHandler - fatal: failed to write commit object
2021-10-07 12:32:35,857 [8688891] INFO - 4idea.branch.GitMergeOperation - Unknown error. {128}


I'm guessing this is because PhpStorm can't display the password form.

At the same time, if I commit through the PhpStorm console, it works fine:
615ecb4e7f468947602839.png

Also, if you enter a password in the console, for example: A session will open, and you can use the gui git in PhpStrom for some time. Until the session is closed so that you need to re-enter the password. Another note is that this error occurs for projects that are located inside the WSL file system. If the project is on host Windows, the signature works normally. Git config: Windows 10 pro. PHPStorm 2021.2.2 > wsl --list --verbose Ubuntu-20.04 Running 2 Why does what error occur? How to fix?
echo "test" | gpg --clearsign
615ecee53c6c6467868262.png


615ecbc6ea658430057955.png

615ec928c149e757958929.png
615ec95d33a6c015313138.png


Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2021-10-07
@SilenceOfWinter

just follow the instructions
https://docs.github.com/en/authentication/managing... (it worked for me, windows 10)

A
Anatoly Soldatov, 2021-10-11
@soldatov

Figured out my problem. To be able to sign a commit with a password-protected gpg key, you need to specify the path for the pinentry program (the program for entering the gpg password).
1. Install gpg on host windows. Download here https://gnupg.org/ Gpg4win installer. In fact, from the entire installed gpg, we need one file.
2. In the wsl subsystem, in the home directory there are false files with the following content:

[email protected]:~$ cat .gnupg/gpg.conf
no-tty
use-agent
[email protected]:~$ cat .gnupg/gpg-agent.conf
pinentry-program "/mnt/c/Program Files (x86)/GnuPG/bin/pinentry-basic.exe"

After that, a window for entering a password will appear:
6163efa770d09415040271.png
Let me remind you that the project files, git, gpg, docker, and other working tools are inside wsl. PhpStorm is installed on windows. Gui idea works well with such a scenario, except for this minor problem.
Perhaps idea will be finalized in the future, and there will be a built-in password entry window, maybe I'm doing something wrong, but for now I have to install gpg in two places. Both on the wsl machine and on the host Windows.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question