Skip to content

Commit e87eb81

Browse files
committed
fix: try to avoid asking ssh passphrase every time while communicating with remote (#1577)
Signed-off-by: leo <[email protected]>
1 parent ffa1a36 commit e87eb81

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Commands/Command.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ protected ProcessStartInfo CreateGitStartInfo(bool redirect)
176176
// Force using this app as SSH askpass program
177177
var selfExecFile = Process.GetCurrentProcess().MainModule!.FileName;
178178
start.Environment.Add("SSH_ASKPASS", selfExecFile); // Can not use parameter here, because it invoked by SSH with `exec`
179-
start.Environment.Add("SSH_ASKPASS_REQUIRE", "force");
179+
start.Environment.Add("SSH_ASKPASS_REQUIRE", "prefer");
180180
start.Environment.Add("SOURCEGIT_LAUNCH_AS_ASKPASS", "TRUE");
181+
if (!OperatingSystem.IsLinux())
182+
start.Environment.Add("DISPLAY", "required");
181183

182184
// If an SSH private key was provided, sets the environment.
183185
if (!start.Environment.ContainsKey("GIT_SSH_COMMAND") && !string.IsNullOrEmpty(SSHKey))

0 commit comments

Comments
 (0)