optimize<SSH>: using core.sshCommand instead of environment parameter GIT_SSH_COMMAND

This commit is contained in:
leo 2023-08-23 20:45:12 +08:00
parent fc43edb6d2
commit 1c10d9a286
6 changed files with 16 additions and 30 deletions

View file

@ -16,8 +16,7 @@ namespace SourceGit.Commands {
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
if (!string.IsNullOrEmpty(sshKey)) {
Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'");
Args = "";
Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
} else {
Args = "-c credential.helper=manager ";
}
@ -35,8 +34,7 @@ namespace SourceGit.Commands {
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
if (!string.IsNullOrEmpty(sshKey)) {
Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'");
Args = "";
Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
} else {
Args = "-c credential.helper=manager ";
}