Search code examples
gnupgioctlrenovate

gpg: error Inappropriate ioctl for device


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 <[email protected]>" 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


Solution

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