I am creating a new machine (macOS Sierra) for web development, and I did brew install gpg , which installed gpg2 and gpg-agent . I copied my keys from ~.gnupg on my old mac. I do not install the Mac GPG Suite that I had on the old machine, as I really prefer to use only the command line.
I set the global git variables with the appropriate settings.
git config --global user.name "Christopher Allen" git config --global user.email " ChristopherA@LifeWithAlacrity.com " git config --global user.mail " ChristopherA@LifeWithAlacrity.com " git config --global user.signingKey F8D36C91357405ED
When I try to commit changes to the git repository where git config commit.gpgsign=true is required, in my old GPG Suite I get a popup where it asks for my password. However, only with GPG, it really finds my public key, but it does not ask for a password for signing.
$ git commit -S -m "changed code" You need a passphrase to unlock the secret key for user: "Christopher Allen < ChristopherA@LifeWithAlacrity.com >" 4096-bit RSA key, ID 357405ED, created 2015-04-16 error: gpg failed to sign the data fatal: failed to write commit object $
The research here, the only mention that I see is " I can not get` git tag -s` to request my GPG password , where it suggests a problem with environment variables for gpg-agent (without a suggested solution) or use the gpg function -preset-passphrase (which I would rather not do).
Further, it turns out that gpg-agent does not work:
$ gpg-agent gpg-agent: no gpg-agent running in this session
I found this page https://blog.chendry.org/2015/03/13/starting-gpg-agent-in-osx.html , which suggests adding this script to .bash_profile:
[ -f ~/.gpg-agent-info ] && source ~/.gpg-agent-info if [ -S "${GPG_AGENT_INFO%%:*}" ]; then export GPG_AGENT_INFO else eval $( gpg-agent --daemon --write-env-file ~/.gpg-agent-info ) fi
After searching for this script, gpg-agent says:
$ gpg-agent gpg-agent: gpg-agent running and available
However, I still have the same problem.
Any ideas on how to fix this? I would rather not use the old GPG Suite, revert to GPG 1.0 or use gpg-preset-passphrase.
Thanks!
- Christopher Allen