jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.99k stars 1.85k forks source link

lazygit stuck when signing with gpg key #30

Open Ronserruya opened 6 years ago

Ronserruya commented 6 years ago

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

jesseduffield commented 6 years ago

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)

Ronserruya commented 6 years ago

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)

OGKevin commented 6 years ago

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

flamendless commented 6 years ago

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

jesseduffield commented 6 years ago

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

Ronserruya commented 6 years ago

@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

jesseduffield commented 6 years ago

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
Ronserruya commented 6 years ago

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

jesseduffield commented 6 years ago

Is that the default linux theme?

Ronserruya commented 6 years ago

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

jesseduffield commented 6 years ago

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

Ronserruya commented 6 years ago

@jesseduffield The GPG signing issue still happens when stashing files

jesseduffield commented 6 years ago

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

mjarkk commented 5 years ago

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:

glvr182 commented 5 years ago

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 commented 5 years ago

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

mjarkk commented 5 years ago

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.

bartgol commented 2 years ago

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

bartgol commented 1 year ago

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

rluetzner commented 3 months ago

Don't know if that will help anyone, but I just ran into this issue today.

The way I solved it was by adding

pinentry-program /usr/bin/pinentry-tty

to ~/.gnupg/gpg-agent.conf and then running

gpg-connect-agent reloadagent /bye

. See also here.

This shows a much simpler prompt and lazygit's UI won't get mangled. Without this I actually couldn't even enter my password in the ncurses TUI and it would always tell me the password was incorrect.

edevil commented 3 months ago

pinentry-tty also seems to mangle the flow for me. I'll have to try pinentry-mac.