65

I have installed GPG via Homebrew with brew install gpg. It is installed in version 2.2.17.

In my Maven POM I have this snippet:

<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>

However when running mvn clean verify I get this error:

gpg: Beglaubigung fehlgeschlagen: Inappropriate ioctl for device
gpg: signing failed: Inappropriate ioctl for device

How can I fix this error?

Harold L. Brown
  • 8,423
  • 11
  • 57
  • 109

5 Answers5

134

I have added

GPG_TTY=$(tty)
export GPG_TTY

to my ~/.bash_profile file. Now it is working.

See also https://github.com/Homebrew/homebrew-core/issues/14737#issuecomment-309848851

Harold L. Brown
  • 8,423
  • 11
  • 57
  • 109
40

On macOS you may want to use pinentry-mac to have GUI window to enter pin and optionally store pin in keychain.

You can install it though Homebrew:

brew install pinentry-mac

And enable it with the following line in your ~/.gnupg/gpg-agent.conf config (create it if it doesn't exists):

pinentry-program /usr/local/bin/pinentry-mac
Dmitry
  • 1,427
  • 15
  • 16
3

Try this

gpg --use-agent --armor --detach-sign --output $(mktemp) pom.xml
Yawar
  • 1,016
  • 1
  • 12
  • 14
  • GPG stopped working for me randomly. This worked like a charm and I still have no idea why. Its like the agent had to be kicked or something. – Adam Gent Mar 16 '23 at 21:20
0

For me, this happened because the terminal window wasn't big enough to fit the passphrase TUI. Once I opened a bigger terminal tab and then I rerun the gpg command, I was able to see the passphrase terminal user interface.

Abdalla Arbab
  • 1,360
  • 3
  • 23
  • 29
0

If anybody gets this error message when typing gpg commands in bash, try adding --no-tty. That fixed it for me.

RedDragonWebDesign
  • 1,797
  • 2
  • 18
  • 24