I'm trying to make a Console Application in C # with some command options to run in Git ssh. The Git ssh executable is in the following path: C: / Program Files (x86) /Git/bin/sh.exe, and I'm trying to run a simple command like this:
string pathGit = "\"C:\Program Files (x86)\Git\bin\sh.exe\" --login";
string commandString = "git";
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = pathGit;
startInfo.Arguments = commandString;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
process.StartInfo = startInfo;
process.Start();
The "--login" in front of the path is required to actually enter the Git console, but it is basically the one that is causing the error. I researched a lot, but I could not find a solution.