GPG commit signoff on WSL

I am using Pycharm with my environment setup on WSL and I've been experiencing some issues while trying to setup GPG commit signing.

I get the following error while using Pycharm's built in commit tool : 

error: gpg failed to sign the data

However, when using the command:

echo "test" | gpg --clearsign

to enter my gpg key password, Pycharm's commiting tool then works until I repoen Pycharm

 

My guess is that the Pinentry password prompt doesn't open properly (from the WSL), refusing my commit as the key password is not entered.

Any idea on how to avoir having me to enter the command each time I reopen Pycharm and only have the prompt asked on the first commit ?

 

0
4 comments
Hello,

Please try a workaround from this thread: https://youtrack.jetbrains.com/issue/IDEA-127802#focus=Comments-27-1866498.0-0

And please let me know if it helps.
0

Hello,
I tried what was suggested on the thread but it did not work.

However, I've managed to find this issue (which is the same problem WSL related but with Visual Studio) and one of the fixes proposed there worked (I haven't tried the others) which was :

1. Install gpg4win (on my windows distribution)
2. set this config in my ~/.gnupg/gpg-agent.conf file in WSL2 ubuntu (I had to create the file):

pinentry-program "/mnt/c/Program Files (x86)/Gpg4win/bin/pinentry.exe"

3. restart the gpg-agent with

gpg-connect-agent reloadagent /bye

4. Reopen Pycharm

3

+1, thank you @Tanguy-Morelle . Worked nicely on my PhpStorm.

0

Please sign in to leave a comment.