diff --git a/src/Commands/Clone.cs b/src/Commands/Clone.cs index 9a37aa2e..28587dab 100644 --- a/src/Commands/Clone.cs +++ b/src/Commands/Clone.cs @@ -17,7 +17,7 @@ namespace SourceGit.Commands { Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Args = ""; } else { - Args = "-c credential.helper=manager "; + Args = "-c credential.helper=manager-core "; } Args += "clone --progress --verbose --recurse-submodules "; diff --git a/src/Commands/Fetch.cs b/src/Commands/Fetch.cs index 9979ff93..9dc95767 100644 --- a/src/Commands/Fetch.cs +++ b/src/Commands/Fetch.cs @@ -19,7 +19,7 @@ namespace SourceGit.Commands { Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Args = ""; } else { - Args = "-c credential.helper=manager "; + Args = "-c credential.helper=manager-core "; } Args += "fetch --progress --verbose "; diff --git a/src/Commands/Pull.cs b/src/Commands/Pull.cs index af6bca05..a93d962f 100644 --- a/src/Commands/Pull.cs +++ b/src/Commands/Pull.cs @@ -19,7 +19,7 @@ namespace SourceGit.Commands { Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Args = ""; } else { - Args = "-c credential.helper=manager "; + Args = "-c credential.helper=manager-core "; } Args += "pull --verbose --progress --tags "; diff --git a/src/Commands/Push.cs b/src/Commands/Push.cs index 211c7c27..7bfd05e6 100644 --- a/src/Commands/Push.cs +++ b/src/Commands/Push.cs @@ -17,7 +17,7 @@ namespace SourceGit.Commands { Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Args = ""; } else { - Args = "-c credential.helper=manager "; + Args = "-c credential.helper=manager-core "; } Args += "push --progress --verbose "; @@ -31,12 +31,30 @@ namespace SourceGit.Commands { public Push(string repo, string remote, string branch) { Cwd = repo; - Args = $"-c credential.helper=manager push {remote} --delete {branch}"; + + var sshKey = new Config(repo).Get($"remote.{remote}.sshkey"); + if (!string.IsNullOrEmpty(sshKey)) { + Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); + Args = ""; + } else { + Args = "-c credential.helper=manager-core "; + } + + Args += $"push {remote} --delete {branch}"; } public Push(string repo, string remote, string tag, bool isDelete) { Cwd = repo; - Args = $"-c credential.helper=manager push "; + + var sshKey = new Config(repo).Get($"remote.{remote}.sshkey"); + if (!string.IsNullOrEmpty(sshKey)) { + Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); + Args = ""; + } else { + Args = "-c credential.helper=manager-core "; + } + + Args += "push "; if (isDelete) Args += "--delete "; Args += $"{remote} refs/tags/{tag}"; }