How to handle gpg-agent in WSL?

8k views Asked by At

I was trying to release a Jar and the gpg-agent was not starting. According to https://www.gnupg.org/documentation/manuals/gnupg-devel/Invoking-GPG_002dAGENT.html it should start automatically on any invocation of a GnuPG program but that doesn't seem to be true in WSL.

pupeno@DESKTOP-5N8VFOD:~$ gpg-agent
gpg-agent: no gpg-agent running in this session

For a moment I thought that maybe GnuPG would just not work in WSL, but I managed to started manually:

pupeno@DESKTOP-5N8VFOD:~$ eval $(gpg-agent --daemon)
pupeno@DESKTOP-5N8VFOD:~$ gpg-agent
gpg-agent: gpg-agent running and available

So, what's missing? Why isn't it starting automatically? or how should I start it?

1

There are 1 answers

2
gutierri On

You want gpg-agent to start automatically, so start it from ~/.bashrc.

echo 'eval $(gpg-agent --daemon)' >> ~/.bashrc