4

I am trying to use gpg to commit to git, I have my username and token already being used and it works without any passphrase using ssh but not for gpg!

I am coming across below error

org.bouncycastle.openpgp.PGPException: missing credentials provider
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyPassphrasePrompt.getPassphrase(BouncyCastleGpgKeyPassphrasePrompt.java:120)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator.findSecretKeyForKeyBoxPublicKey(BouncyCastleGpgKeyLocator.java:279)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator.findSecretKey(BouncyCastleGpgKeyLocator.java:244)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.locateSigningKey(BouncyCastleGpgSigner.java:120)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.sign(BouncyCastleGpgSigner.java:129)
    ... 33 common frames omitted

I want to understand these things:

  1. What credentials/Configuration is expected from jgit to use GPG?
  2. How can we send passphrase and how to make sure cached gpg passphrase is used?

I have tried below things:

  1. Added credentials to at .netrc machine, username and password
  2. Enabled command.setSign(true)
  3. Added SigningKey command.setSigningKey("KEY")

I have these setting:

.netrc

machine github.com
login <login>
password <personal_token>

.zshrc

# GPG
export GPG_TTY=`tty`

.gnupg/gpg-agent.conf

default-cache-ttl 28880
write-env-file /Users/[your user]/.gnupg/gpg-agent-info
pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac

gpg.conf

auto-key-retrieve
no-emit-version
default-key <key>
use-agent
no-tty
jq170727
  • 13,159
  • 3
  • 46
  • 56

0 Answers0