GitUtil.cs 938 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Diagnostics;
  3. namespace FastGithub.ReverseProxy
  4. {
  5. /// <summary>
  6. /// git工具
  7. /// </summary>
  8. static class GitUtil
  9. {
  10. /// <summary>
  11. /// 设置ssl验证
  12. /// </summary>
  13. /// <param name="value">是否验证</param>
  14. /// <returns></returns>
  15. public static bool ConfigSslverify(bool value)
  16. {
  17. try
  18. {
  19. Process.Start(new ProcessStartInfo
  20. {
  21. FileName = "git",
  22. Arguments = $"config --global http.sslverify {value.ToString().ToLower()}",
  23. UseShellExecute = true,
  24. CreateNoWindow = true,
  25. WindowStyle = ProcessWindowStyle.Hidden
  26. });
  27. return true;
  28. }
  29. catch (Exception)
  30. {
  31. return false;
  32. }
  33. }
  34. }
  35. }