8

I'm running a self-hosted Renovate instance and I need to sign the commits to GitLab with GPG key.
For this I'm setting the env variable RENOVATE_GIT_PRIVATE_KEY with the PGP private key block for my GitLab user and this is automatically imported.
But I get the following error when trying to do so:

gpg: directory '/home/ubuntu/.gnupg' created
gpg: keybox '/home/ubuntu/.gnupg/pubring.kbx' created
gpg: /home/ubuntu/.gnupg/trustdb.gpg: trustdb created
gpg: key 72A96C0D4FA8543C: public key "Dummy User <dummyuser@company.com>" imported
gpg: key 72A96C0D4FA8543C/72A96C0D4FA8543C: error sending to agent: Inappropriate ioctl for device
gpg: error building skey array: Inappropriate ioctl for device
gpg: error reading '/tmp/git-private.key': Inappropriate ioctl for device
gpg: import from '/tmp/git-private.key' failed: Inappropriate ioctl for device
gpg: Total number processed: 0
gpg:               imported: 1
gpg:       secret keys read: 1

I did the setup following this instructions https://docs.renovatebot.com/self-hosted-configuration/#gitprivatekey

Fox
  • 163
  • 1
  • 7

2 Answers2

8

I fixed the inappropriate ioctl issue by adding export GPG_TTY=$(tty) prior the command execution

Fox
  • 163
  • 1
  • 7
0

You can fix it telling gpg to not count on a terminal, like reading keyboard (stdin) and so, using the argument --batch.

Considering it is being run by a script the passphrase is expected to be provided by other means, like by --passphrase argument, so a full example:

$ gpg --batch --passphrase ${my_passphrase} --import ${key_path}
Luciano
  • 2,695
  • 6
  • 38
  • 53