resolveURL: HEAD method not universally supported on .git URLs #33

Open
opened 2026-05-04 17:07:59 +02:00 by heiko · 0 comments
Owner

Problem

resolveURL uses http.MethodHead to probe the clone URL for redirects. Some git forges return 404 or 405 for HEAD on .git URLs even when GET would redirect correctly. If that happens, resolveURL returns the original URL and git then encounters the redirect itself — and fails because it strips embedded credentials on cross-host redirects.

Suggested fix

Use http.MethodGet with an immediate body close instead of HEAD. Less efficient but more broadly compatible.


Identified by AI code review (Claude Sonnet 4.6)

## Problem `resolveURL` uses `http.MethodHead` to probe the clone URL for redirects. Some git forges return 404 or 405 for HEAD on `.git` URLs even when GET would redirect correctly. If that happens, `resolveURL` returns the original URL and git then encounters the redirect itself — and fails because it strips embedded credentials on cross-host redirects. ## Suggested fix Use `http.MethodGet` with an immediate body close instead of HEAD. Less efficient but more broadly compatible. --- *Identified by AI code review (Claude Sonnet 4.6)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
heiko/gogogo#33
No description provided.