OpenGPG Key and Password Expire Time

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.

Set Password Expire Time

Set Key Expire Time

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.


Joel's Newsletter

Get a monthly digest of what I'm up to.

Subscribe by Email