我已经通过带有brew install gpg
的自制软件安装了GPG。 它安装在版本2.2.17
中。
在我的Maven POM中,我有这个片段:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
但是,在运行mvn clean verify
时,我收到此错误:
gpg: Beglaubigung fehlgeschlagen: Inappropriate ioctl for device
gpg: signing failed: Inappropriate ioctl for device
如何修复此错误?
我已经添加了
GPG_TTY=$(tty)
export GPG_TTY
到我的~/.bash_profile
文件。现在它正在工作。
另请参阅 https://github.com/Homebrew/homebrew-core/issues/14737#issuecomment-309848851
在macOS上,您可能希望使用pinentry-mac
具有GUI窗口来输入引脚并选择性地将引脚存储在钥匙串中。
您可以通过Homebrew安装它:
brew install pinentry-mac
并在~/.gnupg/gpg-agent.conf
配置中使用以下行启用它(如果不存在,请创建它(:
pinentry-program /usr/local/bin/pinentry-mac
试试这个
gpg --use-agent --armor --detach-sign --output $(mktemp) pom.xml
对我来说,发生这种情况是因为终端窗口不够大,无法容纳密码短语 TUI。一旦我打开一个更大的终端选项卡,然后重新运行 gpg 命令,我就能够看到密码终端用户界面。
如果有人在 bash 中键入gpg
命令时收到此错误消息,请尝试添加--no-tty
。这为我解决了它。