gitmacosbitbucket

Git commit asks for OpenPGP secret key every time


I've been a linux user for a long time, and recently I started using a macbook. As part of my setup process i did the usual "get git going", which included making an ssh key. All that went fine. I also had to instal gpg because git would not let me commit unless my commits were signed, fair enough. I generated the key, and gave it a password. It worked, I can commit freely! Well, sort of.

Whenever I try to commit anything, I get the following message, and am forced to input my password "Please enter the passphrase to unlock the OpenPGP secret key:" Now, i've scoured the internet, and found a lot of articles on how to remember your password when you're git pushing, (which i had already configured), and all other kind of unrelated articles. My coworkers don't have this issue, and I can't find a way to keep from having to input the password every time.

Hopefully there's a super simple how to I missed by virtue of not knowing the right keywords.

Thanks ahead of time.


Solution

  • I followed this guide and was able to get the UI dialog which asks for saving the password to the keychain. Using it with MacOS Monterey 12.0.1.

    Pinentry Mac UI dialog


    1. Content of ~/.gnupg/gpg-agent.conf:
      pinentry-program /opt/homebrew/bin/pinentry-mac
      enable-ssh-support
      
    2. After that, kill all GnuPG processes (Not all of them are actually installed):
      killall gpg-agent
      killall gpg2
      killall gpg
      killall dirmngr
      
    3. Run the following test:
      echo "Test" | gpg -as
      

    The dialog from Pinentry Mac (as shown above) should be showing up.


    For my GPG setup I followed the guide from this gist.