GPG:错误的设备不合适的IOCTL
我正在运行一个自我托管的装修实例,我需要用GPG键签名gitlab。
为此,我将为我的gitlab用户使用PGP私有密钥块设置ENV变量Renovate_git_private_key,这将自动导入。
但是我在尝试这样做时会遇到以下错误:
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
我按照以下说明进行了设置 https ://docs.renovatebot.com/self-hosted-configuration/#gitprivatekey
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过添加
导出gpg_tty = $(tty)
事先命令执行来解决不适当的IOCTL问题I fixed the inappropriate ioctl issue by adding
export GPG_TTY=$(tty)
prior the command execution您可以将其修复告诉GPG不要依靠终端,例如阅读键盘(STDIN),因此,使用参数
- batch
。考虑到它是由脚本运行的,该密码有望通过其他方式提供,例如
- passphrase
参数,因此一个完整的示例:You can fix it telling gpg to not rely 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: