【发布时间】:2020-10-24 05:47:15
【问题描述】:
使用 OnPremise Azure Devops 2019 服务器我正在尝试通过在 ProcessInfo 中调用以下 git 命令以编程方式克隆 git 存储库:
clone https://{username}:{PATTOKEN}@{DEVOPSSERVERDOMAIN}/{TEAMPROJECT}/_git/{PROJECT}
这里是c#代码:
var gitInfo = new ProcessStartInfo
{
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardOutput = true,
FileName = pathToGitExe
};
Process gitProcess = new Process();
gitInfo.Arguments = theCloneCommand
gitInfo.WorkingDirectory = workingFolder;
gitProcess.StartInfo = gitInfo;
gitProcess.Start();
但我不断收到错误
Cloning into 'PROJECT'...
fatal: Authentication failed for '{DEVOPSSERVERDOMAIN}/{TEAMPROJECT}/_git/{PROJECT}'
是否未正确使用 PAT?任何建议
【问题讨论】:
-
嗨,您有没有机会尝试将额外的标头添加到 git 命令中,如下面的答案所述,效果如何?
-
嗨@LeviLu-MSFT 谢谢!我正在测试它,今天我会告诉你!
标签: c# git azure-devops