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

Broken git signing #7467

Closed
dParikesit opened this issue Mar 1, 2025 · 2 comments · Fixed by #7575
Closed

Broken git signing #7467

dParikesit opened this issue Mar 1, 2025 · 2 comments · Fixed by #7575
Labels
bug Something isn't working feedback requested Feedback was requested to help resolve the issue os:mac The MacOS platform

Comments

@dParikesit
Copy link

Version

0.14.8

Operating System

macOS

Distribution Method

dmg (Mac OS - Apple Silicon)

Describe the issue

I'm using macos gitbutler with nix-darwin based gpg. Whenever I try to enable git signing, I always get this error

Image

It used to work on a nightly version of gitbutler (I commented about it in #5022), but it's not working anymore. I don't know the exact version when it stopped working, but I can check it if you need it.

Also, git signing works normally on normal cli git.

How to reproduce (Optional)

No response

Expected behavior (Optional)

No response

Relevant log output (Optional)

@dParikesit dParikesit added the bug Something isn't working label Mar 1, 2025
@Byron Byron added the os:mac The MacOS platform label Mar 11, 2025
@Byron
Copy link
Collaborator

Byron commented Mar 11, 2025

Thanks a lot for reporting!

Could you try to run GitButler from a terminal (where Git CLI signing works) using /Applications/GitButler.app/Contents/MacOS/gitbutler-tauri?

If this works, we know that the environment is causing the issue. Here is where one could assure a shell is always used to invoke the GPG program, something that typically picks up more of the environment (but not necessarily all) that the user sees in a terminal.

pub fn prepare_with_shell_on_windows(program: impl Into<OsString>) -> gix::command::Prepare {
let prepare = gix::command::prepare(program);
if cfg!(windows) {
prepare
.command_may_be_shell_script_disallow_manual_argument_splitting()
// On Windows, this yields the Git-bundled `sh.exe`, which is what we want.
.with_shell_program(gix::path::env::shell())
// force using a shell, we want access to additional programs here
.with_shell()
.with_quoted_command()
} else {
prepare
}
}

If you confirm, I think we should just always invoke it in a shell to increase the chances of successful operation.

@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Mar 11, 2025
@dParikesit
Copy link
Author

Yes it worked if I run gitbutler from the terminal
Image

Byron added a commit to Byron/gitbutler that referenced this issue Mar 11, 2025
This way there are higher chances of picking up the required PATH configuration, making
signing operations more likely to work.
Byron added a commit to Byron/gitbutler that referenced this issue Mar 11, 2025
This way there are higher chances of picking up the required PATH configuration, making
signing operations more likely to work.
Byron added a commit to Byron/gitbutler that referenced this issue Mar 11, 2025
)

The `SHELL` environment variable is set on MacOS to represent the login shell.
It is probably more likely to yield an environment that can run the signing program.

Note that doing so usually is dangerous as well if scripts were to be used,
but that's not the case here - we know a program is provided.
Byron added a commit that referenced this issue Mar 12, 2025
Run GPG in shell on Unix as well (#7467)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback requested Feedback was requested to help resolve the issue os:mac The MacOS platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants