fix: revert git clone http redirection forbidden (#38530) (#38545)

backport #38530
This commit is contained in:
wxiaoguang
2026-07-20 17:21:17 +02:00
committed by GitHub
parent 148d528814
commit 9731ad7c3c
4 changed files with 24 additions and 10 deletions
+1 -3
View File
@@ -121,9 +121,7 @@ func Clone(ctx context.Context, from, to string, opts CloneRepoOptions) error {
}
cmd := gitcmd.NewCommand().AddArguments("clone")
// Never follow HTTP redirects: no clone caller needs them, and a remote redirecting to an
// otherwise-blocked address would be an SSRF vector (e.g. migrating from an attacker URL).
cmd.AddArguments("-c", "http.followRedirects=false")
HandleGitCmdHTTPRedirection(cmd, from, to)
if opts.SkipTLSVerify {
cmd.AddArguments("-c", "http.sslVerify=false")
}