feature<*>: use credential-manager-core instead of old credential-manager

This commit is contained in:
leo 2021-11-15 12:21:34 +08:00
parent acc9840830
commit dcf53c31cc
4 changed files with 24 additions and 6 deletions

View file

@ -17,7 +17,7 @@ namespace SourceGit.Commands {
Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'");
Args = ""; Args = "";
} else { } else {
Args = "-c credential.helper=manager "; Args = "-c credential.helper=manager-core ";
} }
Args += "clone --progress --verbose --recurse-submodules "; Args += "clone --progress --verbose --recurse-submodules ";

View file

@ -19,7 +19,7 @@ namespace SourceGit.Commands {
Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'");
Args = ""; Args = "";
} else { } else {
Args = "-c credential.helper=manager "; Args = "-c credential.helper=manager-core ";
} }
Args += "fetch --progress --verbose "; Args += "fetch --progress --verbose ";

View file

@ -19,7 +19,7 @@ namespace SourceGit.Commands {
Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'");
Args = ""; Args = "";
} else { } else {
Args = "-c credential.helper=manager "; Args = "-c credential.helper=manager-core ";
} }
Args += "pull --verbose --progress --tags "; Args += "pull --verbose --progress --tags ";

View file

@ -17,7 +17,7 @@ namespace SourceGit.Commands {
Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'"); Envs.Add("GIT_SSH_COMMAND", $"ssh -i '{sshKey}'");
Args = ""; Args = "";
} else { } else {
Args = "-c credential.helper=manager "; Args = "-c credential.helper=manager-core ";
} }
Args += "push --progress --verbose "; Args += "push --progress --verbose ";
@ -31,12 +31,30 @@ namespace SourceGit.Commands {
public Push(string repo, string remote, string branch) { public Push(string repo, string remote, string branch) {
Cwd = repo; 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) { public Push(string repo, string remote, string tag, bool isDelete) {
Cwd = repo; 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 "; if (isDelete) Args += "--delete ";
Args += $"{remote} refs/tags/{tag}"; Args += $"{remote} refs/tags/{tag}";
} }