gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Unsupported value for gpg.format (Using 1Password) [login environment missing]

Open lucastraba opened this issue 1 year ago • 3 comments

Version

0.12.24

Operating System

Mac OS X

Distribution Method

dmg (Apple Silicon)

Describe the issue

I configured SSH and commit signing in GitButler via 1Password. Following the documentation, I chose the "Use a Git executable," I added it to my PATH, and then tested. The result, no matter what I do, is that it fetches, but it cannot push:

CleanShot 2024-09-09 at 09 59 41

Here's my config:

[user]
	name = lucastraba
	email = [REDACTED]
	signingkey = [REDACTED]
[gpg]
  format = ssh

[gpg "ssh"]
  program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"

[commit]
  gpgsign = true
[core]
	autocrlf = input

The above is the configuration copied and pasted from the 1Password docs for commit signing: image (Image comes from 1Password, that is not my key)

If I remove the format option, then it works, but it breaks my commit signing elsewhere.

Online searches tell me that that's an issue with the git version, but my git version should not have it.

git version 2.46.0

The Commit signing test does work with the same config.

How to reproduce

  • Set up 1Password commit signing and SSH
  • Set up GitButler
  • When testing connection, it will fail thus: image

Expected behavior

GitButler pushes correctly.

Relevant log output

There was a problem with your credentials
Fetch
Push - Error: Backend error: git command exited with non-zero exit code 128: ["push", "--quiet", "origin", "e2340b5f324f844f6e57a1d2ec44b87647020d1c:refs/heads/test-push-1725869205859"] STDOUT: STDERR: error: unsupported value for gpg.format: ssh fatal: bad config variable 'gpg.format' in file '/Users/lucastraba/.gitconfig' at line 6
Try another setting and test again?
Consult our fetch / push guide
 for help fixing this problem.

lucastraba avatar Sep 09 '24 08:09 lucastraba

Thanks a lot for this wonderful report!

I think I know what's happening: GitButler doesn't pick up Git version 2.46.0 because it's in the PATH of your login shell. The Git it sees is probably closer to git version 2.39.3 (Apple Git-146) (or something else).

To test this, you could launch GitButler directly from a login shell, probably like so:

/Applications/GitButler.app/Contents/MacOS/GitButler

Now I think it will work as it sees the entire login shell environment.

Does this fix the issue for you?

Not having the login shell environment is a known source for trouble and I'd definitely love to find a convenient in-app way to fix it. CC @krlvi just because we recently talked about this.

Byron avatar Sep 09 '24 21:09 Byron

@Byron This is wonderful! This fixes all my problems, the commit signing, the pre-push hooks that got the wrong husky installation, and the access to pnpm to run them.

Spot on solution!

Thanks a lot, and keep up the great work!

lucastraba avatar Sep 10 '24 09:09 lucastraba

That's great to hear!

Let's keep this issue open at least as long as we don't have a tracking issue for making this work. From a UX perspective, I think it would need to be opt-in so the application doesn't unknowing to the user get access to information that's none of its business. Another question then would be how accessible this opt-in checkbox would be, as users would have to know they can try it if they run into seemingly arbitrary issues.

Maybe there could be an onboarding step for the application which asks this? CC @PavelLaptev due to the relevance for UX.

Byron avatar Sep 10 '24 15:09 Byron