mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
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>
This commit is contained in:
committed by
Jesse Duffield
parent
a0963f8036
commit
582fd24d78
@ -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 {
|
||||
|
Reference in New Issue
Block a user