Using OnPremise Azure Devops 2019 server I am trying to programmatically clone a git repository by calling the following git command inside a ProcessInfo:
clone https://{username}:{PATTOKEN}@{DEVOPSSERVERDOMAIN}/{TEAMPROJECT}/_git/{PROJECT}
Here is the c# code:
  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();
But I keep getting the error
Cloning into 'PROJECT'...
fatal: Authentication failed for '{DEVOPSSERVERDOMAIN}/{TEAMPROJECT}/_git/{PROJECT}'
Is the PAT not correctly used? Any suggestions
 
     
    