Update: I wasn’t executing gpg properly. It worked with
gpg --batch --generate-key foo
I am trying to generate keys with gpg and keep running into the error below. Could you please tell me what I need to do? This works on my Mac as well as on other Cloud VMs. I am having this issue only on circleci.
What i am doing: I am invoking a shell script during my run step which does the following:
#!/bin/bash
echo “STARTING GPG STUFF…”
ATTESTOR_EMAIL="myemail@gmail.com"
gpg --quick-generate-key --yes ${ATTESTOR_EMAIL}
gpg --armor --export “${ATTESTOR_EMAIL}” > generated-key.pgp
I keep getting the following error “gpg: agent_genkey failed: Required environment variable not set”
Output:
STARTING GPG STUFF…
gpg: directory ‘/root/.gnupg’ created
gpg: keybox ‘/root/.gnupg/pubring.kbx’ created
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: agent_genkey failed: Required environment variable not set
Key generation failed: Required environment variable not set
gpg: WARNING: nothing exported