I use OpenGPG to sign Git commits on Github and my passwords were expiring too quickly.
I originally tried to increase the key expire times, but this is when the key becomes invalid, not how long the password is cached.
~/.gnupg/gpg.conf
doesn’t exist (which is likely), create it.use-agent
on it’s own line to the gpg.conf
file.default-cache-ttl 86400
to set the password to cache for 1 day.You can list your keys with the following command.
gpg --list-keys
You can set how long a key lasts before it expires with the following command. GPG will prompt you for how long to allow the key to be valid.
gpg --edit-key [key-id] expire
Type quit
to exit GPG and select y
to save.
Written by Joel Dare on March 11, 2024 and last updated March 13, 2024.
Get a monthly digest of what I'm up to.