How can I get GPG Agent to cache my password?

rdegges

I'm a developer, and I commonly sign my Git commits with my GPG key. I've been able to get GPG Agent working properly on OSX so that it only asks me for my password once per day, but I'm having problems getting the same thing working on Ubuntu 16.04.

Here's what I'm doing:

  • I've got my GPG keys setup / etc.
  • I'm in a Git directory.
  • I add some files to Git.
  • I then go to commit them (git commit), and get a GPG password request that looks like this:

    $ git ci
    
    You need a passphrase to unlock the secret key for
    user: "Randall Degges <[email protected]>"
    4096-bit RSA key, ID 8F700DA2, created 2016-04-05
    
    [master 1740961] blah
     1 file changed, 1 insertion(+)
    

The problem is: every single time I do a commit, I'm re-prompted for my GPG password again.

What I'd like to do is configure GPG Agent to cache my password for 1 full day, so it only needs to be entered once.

I've read through tons of documentation and blog posts, and here's what I've tried so far...

First, I modified my ~/.zshrc file (I use zsh) to set the following:

# GPG Agent
export GPG_TTY=$(tty)
export GPGKEY=8F700DA2

Now, from what I read, this alone should do the trick after restarting gpg-agent, but it does not.

So, the next thing I did was I defined a ~/.gnupg/gpg-agent.conf file as explained in the man gpg-agent page:

# Set the default cache time to 1 day.
default-cache-ttl       86400
default-cache-ttl-ssh   86400

# Set the max cache time to 30 days.
max-cache-ttl           2592000
max-cache-ttl-ssh       2592000

This also has no effect.

I've also tried various blog methods, etc., but nothing seems to work. Can someone give me some pointers to things I might be missing?

Jens Erat

In addition to setting up the cache times in gpg-agent.conf, you also have to make sure GnuPG is actually interfacing the gpg-agent. GnuPG 2 and upwards generally does, but the GnuPG 1 branch does not. By default git is using the gpg binary, which (at the time of writing this answer) still is GnuPG 1, while GnuPG 2 is installed as gpg2 on most systems.

In the end, you have two possibilities:

  • set up git to use gpg2 by changing the git configuration:

    git config --global gpg.program gpg2
    
  • set up gpg(GnuPG 1) to use gpg-agent by adding use-agent to gpg.conf

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I get GPG Agent to cache my password?

From Dev

How can I clear my cached gpg password?

From Dev

How can I clear my cached gpg password?

From Dev

How can I restart gpg-agent?

From Dev

How to get passphrase cache duration left in gpg-agent?

From Dev

how can I get gpg to list only my keys?

From Dev

How can I forward a gpg key via ssh-agent?

From Dev

How can I generate gpg keys in scripts without leaving gpg-agent running?

From Dev

gpg-agent is running, but I'm always prompted for password

From Dev

How to get more gpg-agent info?

From Dev

How can I see my password on the terminal?

From Dev

How can I encrypt my pendrive with password?

From Dev

How can I hash the password in my app

From Dev

how can I control the browser agent in my wicket unit test

From Dev

How can I get informations within code about the cache of my app?

From Dev

How can I get my error messages to display only if username or password is not entered correctly using jquery?

From Dev

How can I get an agent to decay as multiple agents feed on it?

From Dev

why can't I get my password to generate on the site for my password generator?

From Dev

How to make gpg find gpg-agent

From Dev

How can I know how well protected my password is on a site?

From Dev

Can I remove my password?

From Dev

How can I cache custom views in my ListView Adapter?

From Dev

How can I cache my website in the user's browser?

From Dev

How can I limit the size of my ~/.cache folder

From Dev

How can I cache/memoize my SQLAlchemy functions?

From Dev

How can I limit the size of my ~/.cache folder

From Dev

How can I cache custom views in my ListView Adapter?

From Dev

How can I show the size of all files in my ~/.cache directory?

From Dev

How can I use my SSD as a ReadyBoost cache disk?

Related Related

  1. 1

    How can I get GPG Agent to cache my password?

  2. 2

    How can I clear my cached gpg password?

  3. 3

    How can I clear my cached gpg password?

  4. 4

    How can I restart gpg-agent?

  5. 5

    How to get passphrase cache duration left in gpg-agent?

  6. 6

    how can I get gpg to list only my keys?

  7. 7

    How can I forward a gpg key via ssh-agent?

  8. 8

    How can I generate gpg keys in scripts without leaving gpg-agent running?

  9. 9

    gpg-agent is running, but I'm always prompted for password

  10. 10

    How to get more gpg-agent info?

  11. 11

    How can I see my password on the terminal?

  12. 12

    How can I encrypt my pendrive with password?

  13. 13

    How can I hash the password in my app

  14. 14

    how can I control the browser agent in my wicket unit test

  15. 15

    How can I get informations within code about the cache of my app?

  16. 16

    How can I get my error messages to display only if username or password is not entered correctly using jquery?

  17. 17

    How can I get an agent to decay as multiple agents feed on it?

  18. 18

    why can't I get my password to generate on the site for my password generator?

  19. 19

    How to make gpg find gpg-agent

  20. 20

    How can I know how well protected my password is on a site?

  21. 21

    Can I remove my password?

  22. 22

    How can I cache custom views in my ListView Adapter?

  23. 23

    How can I cache my website in the user's browser?

  24. 24

    How can I limit the size of my ~/.cache folder

  25. 25

    How can I cache/memoize my SQLAlchemy functions?

  26. 26

    How can I limit the size of my ~/.cache folder

  27. 27

    How can I cache custom views in my ListView Adapter?

  28. 28

    How can I show the size of all files in my ~/.cache directory?

  29. 29

    How can I use my SSD as a ReadyBoost cache disk?

HotTag

Archive