From e87eb8137bc043e0ca8568ce003fe22c4416dcb1 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 13 Aug 2025 16:53:54 +0800 Subject: [PATCH] fix: try to avoid asking ssh passphrase every time while communicating with remote (#1577) Signed-off-by: leo --- src/Commands/Command.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 0b3c890c..44b651b2 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -176,8 +176,10 @@ namespace SourceGit.Commands // Force using this app as SSH askpass program var selfExecFile = Process.GetCurrentProcess().MainModule!.FileName; start.Environment.Add("SSH_ASKPASS", selfExecFile); // Can not use parameter here, because it invoked by SSH with `exec` - start.Environment.Add("SSH_ASKPASS_REQUIRE", "force"); + start.Environment.Add("SSH_ASKPASS_REQUIRE", "prefer"); start.Environment.Add("SOURCEGIT_LAUNCH_AS_ASKPASS", "TRUE"); + if (!OperatingSystem.IsLinux()) + start.Environment.Add("DISPLAY", "required"); // If an SSH private key was provided, sets the environment. if (!start.Environment.ContainsKey("GIT_SSH_COMMAND") && !string.IsNullOrEmpty(SSHKey))