GPG:错误的设备不合适的IOCTL

发布于 2025-02-03 01:00:24 字数 1147 浏览 4 评论 0原文

我正在运行一个自我托管的装修实例,我需要用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏了南城 2025-02-10 01:00:24

我通过添加导出gpg_tty = $(tty)事先命令执行来解决不适当的IOCTL问题

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

放我走吧 2025-02-10 01:00:24

您可以将其修复告诉GPG不要依靠终端,例如阅读键盘(STDIN),因此,使用参数- batch

考虑到它是由脚本运行的,该密码有望通过其他方式提供,例如- passphrase参数,因此一个完整的示例:

$ gpg --batch --passphrase ${my_passphrase} --import ${key_path}

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:

$ gpg --batch --passphrase ${my_passphrase} --import ${key_path}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文