agent refused operation when using GnuPG key for ssh

Pankaj Jangid pankaj at
Wed Sep 30 10:41:04 CEST 2020

On Tue, Sep 29 2020, Werner Koch via Gnupg-users wrote:

> On Mon, 28 Sep 2020 23:54, Pankaj Jangid said:
>> debug3: sign_and_send_pubkey: signing using rsa-sha2-512
>> sign_and_send_pubkey: signing failed: agent refused operation
> Algorithm looks okay.  You need to look at the gpg-agent log.  Put
> log-file /somewhere/gpg-agent.log
> verbose
> into ~/.gnupg/gpg-agent.conf and restart the agent ("gpgconf --reload
> gpg-agent" should be sufficient.  Run ssh again, check the log and post
> it.  What vesion of GnUPg are you running?  ("gpg-agent --version").


The error was coming because it could not find the tty to ask for
passphrase. Now I am doing this in my ~/.bash_profile

#+BEGIN_SRC bash
export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpg-connect-agent updatestartuptty /bye

In the stackoverflow archives, someone indicated about installing
pinentry-mac for macOS. This gave me hint. I had the pinentry-curses
already installed. So looked for how to tell this to gpg-agent and found

Then ran,

gpg-connect-agent 'help updatestartuptty'


Pankaj Jangid

GnuPG Fingerprint => 0B62 7424 3B26 A911 052A  DDE6 7C95 6E6F F858 7689

More information about the Gnupg-users mailing list