Home > database >  GPG key works only for a few minutes
GPG key works only for a few minutes

Time:02-21

I use my GPG key to commit to GitHub but every time I want to commit again (for the first time in a new terminal) It asks me for a password every time.

How do I fix that I don't need to enter my password every time on my own machine.

I am using MacOS with ZSH terminal.

EDIT: I don't have a conf file. I don't know where it is located. I installed gpg with brew install gnupg Files inside ~./gnupg/ >> https://i.stack.imgur.com/B8pyX.png

CodePudding user response:

Add two lines below in ~/.gnupg/gpg-agent.conf (Create one if you don't have one)

default-cache-ttl 34560000
max-cache-ttl 34560000

The default-cache-ttl and max-cache-ttl is set to a really high value - 400 days to be precise. GnuPG will now cache the passphrase for that length of time or until you next restart your machine.

This saves you from being prompted for the passphrase every single commit given the default cache time.

  • Related