diff options
author | band-a-prend <torokhov-s-a@yandex.ru> | 2020-10-10 03:43:59 +0300 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-10 17:58:23 +1100 |
commit | 582fd24d78e5735655c9ba7d6aaa246769398495 (patch) | |
tree | d5e09c6829805ba1d2626b7ed675f460e465744f /pkg/gui | |
parent | a0963f8036fcb4d87292922827e1e1c28555d961 (diff) |
Add SSH key passphrase prompt to pull/push from/to remote git repo
This commit resolves issue with absence of ssh key prompting
to pull from or push to remote git repository.
I checked lazygit with this patch for successfully pull from
and push to https://gitweb.gentoo.org/repo/proj/guru.git repository.
While for lazygit-0.23.1 I'm not able to do that.
The check for Passphrase follows the Password because of
more long time before SSH key is prompt in terminal.
Otherwise after timeout "Password" prompt is appears.
Excuse me for google translated i18n dutch lines.
Bug: https://github.com/jesseduffield/lazygit/issues/534
Signed-off-by: band-a-prend <torokhov-s-a@yandex.ru>
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/credentials_panel.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go index d125e3c8f..4f24f9844 100644 --- a/pkg/gui/credentials_panel.go +++ b/pkg/gui/credentials_panel.go @@ -9,7 +9,7 @@ import ( type credentials chan string -// promptUserForCredential wait for a username or password input from the credentials popup +// promptUserForCredential wait for a username, password or passphrase input from the credentials popup func (gui *Gui) promptUserForCredential(passOrUname string) string { gui.credentials = make(chan string) gui.g.Update(func(g *gocui.Gui) error { @@ -17,9 +17,12 @@ func (gui *Gui) promptUserForCredential(passOrUname string) string { if passOrUname == "username" { credentialsView.Title = gui.Tr.CredentialsUsername credentialsView.Mask = 0 - } else { + } else if passOrUname == "password" { credentialsView.Title = gui.Tr.CredentialsPassword credentialsView.Mask = '*' + } else { + credentialsView.Title = gui.Tr.CredentialsPassphrase + credentialsView.Mask = '*' } if err := gui.switchContext(gui.Contexts.Credentials.Context); err != nil { @@ -30,7 +33,7 @@ func (gui *Gui) promptUserForCredential(passOrUname string) string { return nil }) - // wait for username/passwords input + // wait for username/passwords/passphrase input userInput := <-gui.credentials return userInput + "\n" } @@ -70,10 +73,10 @@ func (gui *Gui) handleCredentialsViewFocused() error { func (gui *Gui) handleCredentialsPopup(cmdErr error) { if cmdErr != nil { errMessage := cmdErr.Error() - if strings.Contains(errMessage, "Invalid username or password") { + if strings.Contains(errMessage, "Invalid username, password or passphrase") { errMessage = gui.Tr.PassUnameWrong } - // we are not logging this error because it may contain a password + // we are not logging this error because it may contain a password or a passphrase gui.createErrorPanel(errMessage) } else { _ = gui.closeConfirmationPrompt(false) |