I tried to sign my commits with the git commit -S command, but it does not work without asking for my passphrase for my GPG key.
Error:
error: gpg failed to sign the data fatal: failed to write commit object
I noticed that if I ran the following command before git commit -S :
gpg -o /dev/null --local-user MY_KEY_ID -as <(echo 1234) && echo "The correct passphrase was entered for this key"
... everything works well, and my commits are correctly signed. I think this is because my passphrase is cached, but this is not the behavior that I expect.
I was hoping Git would request my passphrase every time I want to sign commits or tags.
The command "unlock my key" was found on this issue: How to use the gpg command line correctly to check the passphrase
source share