summaryrefslogtreecommitdiffstats
path: root/pkg/commands/oscommands
diff options
context:
space:
mode:
authorband-a-prend <torokhov-s-a@yandex.ru>2020-10-10 03:43:59 +0300
committerJesse Duffield <jessedduffield@gmail.com>2020-10-10 17:58:23 +1100
commit582fd24d78e5735655c9ba7d6aaa246769398495 (patch)
treed5e09c6829805ba1d2626b7ed675f460e465744f /pkg/commands/oscommands
parenta0963f8036fcb4d87292922827e1e1c28555d961 (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/commands/oscommands')
-rw-r--r--pkg/commands/oscommands/os.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go
index e16a821de..5d37e2f4f 100644
--- a/pkg/commands/oscommands/os.go
+++ b/pkg/commands/oscommands/os.go
@@ -143,18 +143,19 @@ func (c *OSCommand) RunCommandWithOutputLive(command string, output func(string)
return RunCommandWithOutputLiveWrapper(c, command, output)
}
-// DetectUnamePass detect a username / password question in a command
-// promptUserForCredential is a function that gets executed when this function detect you need to fillin a password
-// The promptUserForCredential argument will be "username" or "password" and expects the user's password or username back
+// DetectUnamePass detect a username / password / passphrase question in a command
+// promptUserForCredential is a function that gets executed when this function detect you need to fillin a password or passphrase
+// The promptUserForCredential argument will be "username", "password" or "passphrase" and expects the user's password/passphrase or username back
func (c *OSCommand) DetectUnamePass(command string, promptUserForCredential func(string) string) error {
ttyText := ""
errMessage := c.RunCommandWithOutputLive(command, func(word string) string {
ttyText = ttyText + " " + word
prompts := map[string]string{
- `.+'s password:`: "password",
- `Password\s*for\s*'.+':`: "password",
- `Username\s*for\s*'.+':`: "username",
+ `.+'s password:`: "password",
+ `Password\s*for\s*'.+':`: "password",
+ `Username\s*for\s*'.+':`: "username",
+ `Enter\s*passphrase\s*for\s*key\s*'.+':`: "passphrase",
}
for pattern, askFor := range prompts {