Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpg signing is not working correctly #5022

Open
slamp opened this issue Oct 2, 2024 · 4 comments
Open

gpg signing is not working correctly #5022

slamp opened this issue Oct 2, 2024 · 4 comments
Labels

Comments

@slamp
Copy link

slamp commented Oct 2, 2024

Version

0.12.27

Operating System

Mac OS X

Distribution Method

dmg (Apple Silicon)

Describe the issue

Hello,

I'm trying to sign with GPG my commit. In project settings I got the error: "gpg: signing failed: Inappropriate ioctl for device"
This could be solved by doing a export GPG_TTY=$TTY
I have the export in my .zshrc configuration

gpg-signing-issue

How to reproduce

MacOS Apple M2
gpg (GnuPG) 2.4.5
libgcrypt 1.10.3

Go to 'Project settings', click 'Git', enable 'Sign commits'
Define the 'signing program' to /opt/homebrew/bin/gpg
Click 'Test signing'

Expected behavior

GPG signing is working

Relevant log output

Signing is not working correctly
Failed to sign GPG:  [GNUPG:] KEY_CONSIDERED xxxxxxxx 2
[GNUPG:] BEGIN_SIGNING H10
[GNUPG:] PINENTRY_LAUNCHED 30528 curses 1.3.1 - - - - 502/20 0
gpg: signing failed: Inappropriate ioctl for device
[GNUPG:] FAILURE sign 83918950
gpg: signing failed: Inappropriate ioctl for device
@slamp slamp added the bug Something isn't working label Oct 2, 2024
@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Oct 2, 2024
@Byron
Copy link
Collaborator

Byron commented Oct 2, 2024

Thanks for reporting!

Could you try to launch GitButler from a terminal window, for instance with /Applications/GitButler.app/Contents/MacOS/GitButler?

If that works, it's clearly an issue with GitButler, as windowed application, not seeing the necessary environment variables, which is a known issue.

Thanks for your help.

@slamp
Copy link
Author

slamp commented Oct 3, 2024

By launching GitButler in commandline, gpg asked me the Passphrase
gpg-sign
and then I was able to sign a commit
gitbutler-gpg-ok

So it works this way !

@Byron Byron removed the feedback requested Feedback was requested to help resolve the issue label Oct 3, 2024
@Byron
Copy link
Collaborator

Byron commented Oct 3, 2024

That's great to hear!

Thanks also for showing a screenshot, as it makes clear that the password entry is bound to having a terminal. So even if everything was configured correctly even without having all the environment variables, gpg would still be unable to query the password if there is no underlying terminal.

In order for GitButler to be handling this, it would somehow have to provide a terminal session to the programs Git may launch while creating commits - maybe that's possible somehow.

@Caleb-T-Owens
Copy link
Contributor

Sorry for the inconvenience!

There are three action points here:

  1. Investigate whether allowing the user to enter environment variables in the configuration could enable expert users to resolve situations like this on their own (perhaps there are some sensible defaults we can provide).
  2. Investigate whether there is another set of environments we should be providing to prompt this gpg program to use our askpass setup
  3. Document this work-around in our signing documentation page (good first issue).
  4. As Byron suggests, perhaps we can detect that the signing program is waiting on something from STDIN, and open up a small shell prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants