4

I've been using GPG on WSL2 Debian for some time now and everything worked perfectly, but yesterday I started receiving an error about gpg signs when using git.

Trying to run echo "test" | gpg --clearsign, I receive the following message:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

test
gpg: signing failed: No such file or directory
gpg: [stdin]: clear-sign failed: No such file or directory

I tried the following to fix the problem:

  • Kill gpg-agent with gpgconf --kill gpg-agent and killall gpg-agent
  • Restart WSL2
  • Restart my host machine
  • Generate a new key, which gives me the same message as test sign
  • Create a gpg.conf file with no-tty option
  • Use chmod 700 on ~/.gnupg/private-keys-v1.d

I'm using gpg version 2.2.27 with libgcrypt 1.8.8.

2 Answers 2

11

Turns out that something overwrote my tty variable, which made gpg go crazy, because in my .zshrc I had exported GPG_TTY as $(tty). I managed to solve this issue with export GPG_TTY=`tty`.

Edit: After further investigation I found out that the fault lies within Powerlevel10k, for more info see this StackExchange thread.

0

I was having this issue using Rider on Debian.

Finally resolved it by following these instructions: https://wiki.archlinux.org/title/GnuPG#Unattended_passphrase

Add allow-loopback-pinentry to ~/.gnupg/gpg-agent.conf

Add pinentry-mode loopback to ~/.gnupg/gpg.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .