Connect your gpg-agent to 1Password so you can unlock your GPG key from the password manager.
- 1Password CLI
- GnuPG
First, copy the pinentry-1password.sh script to a suitable location and set it as executable, i.e. chmod +x pinentry-1password.sh.
Then to your ~/.gnupg/gpg-agent.conf file, add (or update) the following entry:
pinentry-program <path to the pinentry-1password.sh script>
Then set the following two environment variables:
export OP_GPG_ENTRY=""
export OP_GPG_VAULT=""Optionally set the following if the field on the 1Password entry is not password:
export OP_GPG_FIELD=""Finally, kill and restart your gpg-agent:
gpg-connect-agent killagent /bye; gpg-connect-agent updatestartuptty /byeYou can get the values for these variables from the "private link" option within the 1Password desktop application for the selected entry. For example:
https://start.1password.com/open/i?a=<your account ID>&v=<your vault ID>&i=<your entry ID>&h=my.1password.com
I have had success using the API Credential type; I can use the credential field for the password and use the expires field for notification of expiring keys. Moreover, I add my public and private GPG keys as files.
I stumbled upon mrgrain's original gist, and boom, we were off to the races! This is a slightly modified version of that script.
copilot said that response needs to be percent encoded, just FYI
e.g.
sed -e 's/%/%25/g'