You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ExtraHeadersFor() duplicates http.<url>.extraHeader values on every authentication retry, producing malformed headers that cause an infinite 401 loop.
When a custom authentication header is configured via http.extraHeader and lfs.access is not set to basic, Git LFS retries authentication using the same *http.Request object. Each retry calls ExtraHeadersFor(), which copies all existing headers (including previously appended extra headers) and appends the extra headers again. After two iterations the header value is already malformed, causing every subsequent request to fail with 401 — which triggers another retry, ad infinitum.
Clone a repo with LFS content, withoutlfs.access set to basic:
git clone https://git.example.com/org/repo.git
Git LFS prompts for credentials. Entering valid credentials leads to an infinite loop of password prompts.
Expected behavior
Extra headers should be applied exactly once per request, regardless of how many auth retries occur. Valid credentials should be accepted on the retry.
Hey, thanks for the bug report and reproduction case!
As it happens, we're already aware of the HTTP recursion issue; see the notes in PR #6018 for details. I have continued to expand that PR and expect we'll be able to merge it (with additional changes) in the next couple of weeks.
Once that's done, we can revisit this issue and see what remains to be resolved with respect to the handling of extra headers.
Activity
fix(http): prevent extra header duplication on retry
fix(api): prevent infinite recursion in auth retry loop
chrisd8088 commentedon Feb 9, 2026
Hey, thanks for the bug report and reproduction case!
As it happens, we're already aware of the HTTP recursion issue; see the notes in PR #6018 for details. I have continued to expand that PR and expect we'll be able to merge it (with additional changes) in the next couple of weeks.
Once that's done, we can revisit this issue and see what remains to be resolved with respect to the handling of extra headers.
fix(http): prevent extra header duplication on retry
fix(http): prevent extra header duplication on retry