feature<SSH>: supports using ssh private key to access remote git repository

This commit is contained in:
leo 2021-10-12 17:14:48 +08:00
parent 306292147f
commit 75a46ceb74
11 changed files with 200 additions and 18 deletions

View file

@ -11,7 +11,16 @@ namespace SourceGit.Commands {
Cwd = repo;
TraitErrorAsOutput = true;
handler = onProgress;
Args = "-c credential.helper=manager push --progress --verbose ";
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
if (!string.IsNullOrEmpty(sshKey)) {
Environment.SetEnvironmentVariable("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'");
Args = "";
} else {
Args = "-c credential.helper=manager ";
}
Args += "push --progress --verbose ";
if (withTags) Args += "--tags ";
if (track) Args += "-u ";