Search code examples
macospasswordsgpg-agent

Password expiration for Mac GPGSuite


I have a Mac with OS Sequoia 15.2 and I have set up a Gpg key that's protected by a password. I use GPG Suite from gpg tools.

When I try committing my code via git I'm most usually asked to reenter my gpg password. Sometimes if I've already committed recently I'm not prompted to enter a password again.

I'd like to be able to configure the amount of time that needs to pass before being promoted to reenter a password. Is this feasible? If yes, how can I achieve this? Are there alternative ways for doing this?

Thank you in advance!

I've found some suggestions like this one with a solution via command line. I'm not that accustomed to command line and would like some alternative solutions if there are any.


Solution

  • You may follow this guide to make the password be remembered for more or less time via the macOS keychain UI. As mentioned in the doc:

    GPG Suite preferences pane (old name: GPGPreferences) password section also has the option to set a certain time your password can be cached. Enter any amount of seconds for which you want your password to be remembered. Password queries after that time period will again show pinentry asking for your password.

    However, keep in mind that it seems you can't make your GPG password be remembered for a longer period of time than 99999 seconds. If you'd like the password to be requested after an even longer time you may consider removing completely the password if that suits your needs better.