Git 安装完成后重置缓存并重新探测

This commit is contained in:
user123
2026-01-30 01:30:46 +08:00
parent 9927adf716
commit 57ea60f31f
2 changed files with 19 additions and 10 deletions

Binary file not shown.

View File

@@ -380,17 +380,25 @@ func ConfigureNpmMirror() error {
}
func ConfigureGitProxy() error {
var lastErr error
for i := 0; i < 3; i++ {
ResetPathCache()
gitPath, err := GetGitPath()
if err != nil {
return err
}
lastErr = err
} else {
proxy := gitProxy()
key := fmt.Sprintf("url.%shttps://github.com/.insteadOf", proxy)
cmd := exec.Command(gitPath, "config", "--global", key, "https://github.com/")
if err := cmd.Run(); err != nil {
return fmt.Errorf("设置 git 代理失败: %v", err)
}
if err := cmd.Run(); err == nil {
return nil
} else {
lastErr = fmt.Errorf("设置 git 代理失败: %v", err)
}
}
time.Sleep(300 * time.Millisecond)
}
return lastErr
}
// downloadFile 下载文件
@@ -799,6 +807,7 @@ func InstallGit() error {
return fmt.Errorf("git 安装失败: %v, Output: %s", err, string(out))
}
ResetPathCache()
SetupGitEnv()
return nil
}