diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 72c10b0c..7435dbfa 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -188,10 +188,8 @@ namespace SourceGit.Commands start.Environment.Add("SOURCEGIT_LAUNCH_AS_ASKPASS", "TRUE"); // If an SSH private key was provided, sets the environment. - if (!string.IsNullOrEmpty(SSHKey)) - start.Environment.Add("GIT_SSH_COMMAND", $"ssh -o StrictHostKeyChecking=accept-new -i '{SSHKey}'"); - else - start.Environment.Add("GIT_SSH_COMMAND", $"ssh -o StrictHostKeyChecking=accept-new"); + if (!start.Environment.ContainsKey("GIT_SSH_COMMAND") && !string.IsNullOrEmpty(SSHKey)) + start.Environment.Add("GIT_SSH_COMMAND", $"ssh -i '{SSHKey}'"); // Force using en_US.UTF-8 locale to avoid GCM crash if (OperatingSystem.IsLinux()) @@ -201,14 +199,9 @@ namespace SourceGit.Commands if (OperatingSystem.IsMacOS()) { if (start.Environment.TryGetValue("PATH", out var path)) - { - path = "/opt/homebrew/bin:/opt/homebrew/sbin:" + path; - } + start.Environment.Add("PATH", $"/opt/homebrew/bin:/opt/homebrew/sbin:{path}"); else - { - path = "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; - } - start.Environment.Add("PATH", path); + start.Environment.Add("PATH", "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"); } // Force using this app as git editor.