我在c#项目中本地使用git命令,并且工作成功, 但是当我将其部署到iis时,git fetch和git pull无法正常工作,而其他git命令例如:git checkout,git tag成功运行。
对于我使用Process库的git命令:
Process proc = new Process();
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.FileName = ConfigurationManager.AppSettings["gitPath"];
proc.StartInfo.WorkingDirectory = Path.Combine(path, project);
proc.StartInfo.Arguments = "fetch";
proc.Start();
stderr_str = proc.StandardError.ReadToEnd();
proc.WaitForExit();
if (proc.ExitCode != 0)
throw new Exception(stderr_str.ToString());
在本地工作,但是在iis上该命令未完成,也不会引发错误。我还使用了具有相同结果的PowerShell库。