How can I clear my cached gpg password?

I’ve tried:

  • the SIGHUP method –> no succes
  • the cache timeout in gpg-agent.conf –> it seems that this file is not read, althougt I have the ‘use-agent’ line in gpg.conf

What should I do ?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

for those really using gpg-agent, you can forget passphrases with:

echo RELOADAGENT | gpg-connect-agent

Solution 2

GPG: In a single command:

gpg-connect-agent reloadagent /bye

SSH: for ssh agent you probably want those two:

ssh-add -D    #delete identities
ssh-agent -k  #kill ssh-agent

Solution 3

Let me begin by saying I had the exact same issue…


Your GPG secrets are probably being handled by the Gnome Keyring, even if gpg-agent is running. This answer provides some details on the available options for it.

Another way is to disable the GPG component of the Gnome Keyring, so that gpg-agent is used:

  • You can do this by removing (or renaming to something other than *.desktop) the file /etc/xdg/autostart/gnome-keyring-gpg.desktop.
  • It’s possible you already have the necessary settings for gpg-agent to autostart. At least for me, running Ubuntu 13.04, that’s true. However, if you need to, refer this post for some information on how to configure it.
  • After logging off and on again, just gpg-agent should be running, and it does respond both to settings in ~/.gnupg/gpg-agent.conf and to SIGHUP signals.
  • On a final note, it may be wise to also disable the SSH component of Gnome Keyring, since:
    • You probably also don’t want your SSH keys unlocked for the whole session, and might want to use/configure ssh-agent or gpg-agent
    • It’s possible that your configuration for gpg-agent autostart already includes SSH support (the default one in Ubuntu 13.04 does)

Solution 4

gpgconf --reload gpg-agent

This works for me … hope this answers your question.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply