lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

lazygit stuck when signing with gpg key

Open Ronserruya opened this issue 5 years ago • 18 comments

When signing a commit with a gpg key https://help.github.com/articles/signing-commits-using-gpg/

The "input your password" dialog appears, and lazygit gets stuck, CTRL + C/Z doesn't solve that. (and you cant input your passphrase and sign)

remove

Ronserruya avatar Aug 06 '18 06:08 Ronserruya

Is this a prompt that will appear each time you commit in this repo? Or is it a once-off? It might be a bit tricky to fix this because the call to git commit assumes no input will be needed, and there's currently no code in the app that deals with interacting with subprocesses (but there should be soon)

jesseduffield avatar Aug 06 '18 06:08 jesseduffield

It is a setting in .gitconfig

    gpgsign = true

it can either be every time you commit, or on a cooldown (for example ,once in 12 hours)

Ronserruya avatar Aug 06 '18 07:08 Ronserruya

It fails even when no input from the user is required :( when signing the commit.

OGKevin avatar Aug 06 '18 08:08 OGKevin

I agree, it gets stuck. no way to cancel it :/

flamendless avatar Aug 06 '18 13:08 flamendless

@Ronserruya @flamendless @OGKevin I've just pushed a potential fix to master. Let me know if that fixes the issue (it just opens the subprocess to enter your password if you have gpgsign = true)

jesseduffield avatar Aug 08 '18 10:08 jesseduffield

@jesseduffield It works! Thanks :)

Something else I noticed is that the outlines appear now only if you are navigating this item (TAB will move to 'branches' and the white outline will appear) , not sure if this is a result of this fix or anything else in master.

In the screenshot you can see that the boxes has black outlines, but they cannot be seen on a black background

if its unrelated to this fix, let me know if you want me to open a separate issue :)

lazygit

Ronserruya avatar Aug 08 '18 11:08 Ronserruya

I always knew this day would come...

Haha yeah as a response to some issues stating it was hard to identify which panel was focused, I set the borders around unfocused panels to 'black' which in all my iterm2 themes is actually more like a grey against the background. I noticed that windows users almost all ended up with the invisible panel borders like in your case, and added a check on platform when setting that colour.

Looks like this might be the first case where we should introduce a config for border-colors. I'm gonna need to do some research on how to set up a config file, and it's gonna be tricky to get config-related stuff right, but I'll get started on it now

In the very short term, you can go in to gui.go and delete

	if runtime.GOOS != "windows" {
		g.FgColor = gocui.ColorBlack
	}

Or if you want it to look really cool....


	g.FgColor = gocui.ColorMagenta

jesseduffield avatar Aug 08 '18 11:08 jesseduffield

Awesome, btw thats Linux, not windows, so you might want to add that to your checks as well :+1:

Ronserruya avatar Aug 08 '18 11:08 Ronserruya

Is that the default linux theme?

jesseduffield avatar Aug 08 '18 11:08 jesseduffield

The default one on Ubuntu is with a purple background, not sure about all other distros

Ronserruya avatar Aug 08 '18 11:08 Ronserruya

I've just made it have white borders on linux to be on the safe side. Configurable color options will remove the confusion anyway once that's done :)

jesseduffield avatar Aug 08 '18 11:08 jesseduffield

@jesseduffield The GPG signing issue still happens when stashing files

Ronserruya avatar Aug 12 '18 08:08 Ronserruya

@Ronserruya I've just put up a PR https://github.com/jesseduffield/lazygit/pull/133 for this. I've made a test repo generator to get me to sign a stash but I can't get it asking for my password. Would you be able to pull this down and test it, and let me know what config is required to make it request for password on stash?

jesseduffield avatar Aug 12 '18 12:08 jesseduffield

I'm trying to test this locally but whatever i do it always show a popup to ask for credentials:
Is there a way to turn off the popup and make to make gpg ask this inside the terminal?
image
System information:

  • OS: solus (linux)
  • Git gpg items: commits.gpgsign = true and user.signingkey = TheKeyID

mjarkk avatar May 19 '19 11:05 mjarkk

https://stackoverflow.com/questions/17769831/how-to-make-gpg-prompt-for-passphrase-on-cli This might work, havent tried it myself since my OS forces everything over terminal already

glvr182 avatar May 19 '19 12:05 glvr182

But i can confirm this bug still exist and also happens with password protected ssh keys

glvr182 avatar May 19 '19 12:05 glvr182

Thanks that removed the popup, I think all these problems can be solved the same way as dune in #372 (using lg as a agent for ssh, gpg, git),
I'll take a look at this and see if i can add this functionality to https://github.com/mjarkk/go-git-http-credentials-helper .

I'm not going to add the functionality to #372 because the pr is already long active and it might be better to have that merged in first before adding this functionality.

mjarkk avatar May 20 '19 05:05 mjarkk

Is there any update on this? I can confirm this is still an issue with lazygit 0.35.

bartgol avatar Aug 26 '22 16:08 bartgol

One thing I noticed: if you manage to put in the gpg password, and your only issue is that the window is now scrambled, with some gpg output still overlayed, you can reduce/increase the terminal font, and that would immediately remove all the leftover junk output, restoring a pristine lazygit overview.

However, my issue is that while I'm typing the gpg password, lazygit is still listening to my keystroke, so I end up activating random lazygit commands. See pics below. In the second pic, I started to type my password, and eventually I hit a character that triggers special lazigit behaviors. When that happens, I can use arrows, until I see the Cancel button of the gpg prompt highlighted, then hit Enter. This terminates the signature, returning to lazygit (which is completely scrambled then, but that's fixable, as discussed above). In this case, my solution is to create a new commit, then move the commit down. In fact, when signing a new commit, lazigit interacts with gpg correctly (no scrambling, no lazigit capturing my keystrokes during signature), which makes me believe that perhaps this is fixable, and maybe something is amiss just with lazygit handling of the rebase process.

I can ofc use a popup window (I do it when I'm physically at my workstation), but when I'm working remotely, I prefer to use terminal signature (it's faster than waiting for the popup to appear).

are_you_sure whoops

bartgol avatar May 19 '23 15:05 bartgol