Skip to content

Instantly share code, notes, and snippets.

@tknv
Created November 17, 2016 17:28
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tknv/43604e851a371949343b78261c48f190 to your computer and use it in GitHub Desktop.
Save tknv/43604e851a371949343b78261c48f190 to your computer and use it in GitHub Desktop.
~/.gnupg/gpg-agent.conf
default-cache-ttl 28800
# 8 hours
pinentry-program /usr/bin/pinentry-curses
allow-loopback-pinentry
@tknv
Copy link
Author

tknv commented Nov 17, 2016

pass insert mail/work-gpg

@marcofranssen
Copy link

marcofranssen commented Jul 24, 2020

I have been trying this as well. Somehow it does not take my ttl setting.

$ cat /Users/marco/.gnupg/gpg-agent.conf
default-cache-ttl 3600

$ gpg-agent --gpgconf-list
gpgconf-gpg-agent.conf:16:"/Users/marco/.gnupg/gpg-agent.conf
verbose:8:
quiet:8:
debug-level:24:"none:
log-file:8:
default-cache-ttl:24:600:
default-cache-ttl-ssh:24:1800:
max-cache-ttl:24:7200:
max-cache-ttl-ssh:24:7200:
enforce-passphrase-constraints:8:
min-passphrase-len:24:8:
min-passphrase-nonalpha:24:1:
check-passphrase-pattern:24:
max-passphrase-days:24:0:
enable-passphrase-history:8:
no-grab:8:
ignore-cache-for-signing:8:
no-allow-external-cache:8:
no-allow-mark-trusted:8:
disable-scdaemon:8:
enable-ssh-support:0:
ssh-fingerprint-digest:24:"md5:
no-allow-loopback-pinentry:8:
allow-emacs-pinentry:8:
pinentry-timeout:24:0:
enable-extended-key-format:8:
grab:8

As you can see I have my ttl at 3600, but when checking the active config it still shows 600. As you can see it does read the config file I defined.

Running this from zsh on MacOS using iTerm.

Also tried killing the active gpg-agent and closing and reopening the shells.

@tknv
Copy link
Author

tknv commented Jul 25, 2020

@tknv
Copy link
Author

tknv commented Jul 25, 2020

I could check set values by;
gpgconf --list-options gpg-agent
I am not sure your command shows actually applied config params.

       --gpgconf-list
              This command is similar to --list-config but in general only internally used by the gpgconf tool.

from man page of gpg2.

@marcofranssen
Copy link

You where right. gpgconf --list-options gpg-agent shows the correct value. Let me check if it is now properly caching for an hour as opposed to the default ten minutes.

@FradSer
Copy link

FradSer commented Nov 9, 2020

Try gpg-connect-agent reloadagent /bye to reload agent.

@PaulRBerg
Copy link

PaulRBerg commented Nov 11, 2020

I want to use gpg signing in git and set a very long passphrase cache, but for some reason git doesn't pick up the settings I listed in ~/.gnupg/gpg-agent.conf:

default-cache-ttl 1209600
max-cache-ttl 31536000

Also my global .gitconfig file:

[commit]
	gpgSign = true

What am I missing?

Update: I posted this as a question on StackOverflow.

@marcofranssen
Copy link

I have provided you with my solution. I'm prompted by the gpg agent once an hour to provide my credentials for the key.

@tknv
Copy link
Author

tknv commented Nov 12, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment