Skip to content

fix(git): don't pass extraCloneOpts to ls-remote when local clone exists - #42491

Merged
viceice merged 4 commits into
renovatebot:mainfrom
Churro:fix/repository-ls-remote
Apr 15, 2026
Merged

fix(git): don't pass extraCloneOpts to ls-remote when local clone exists#42491
viceice merged 4 commits into
renovatebot:mainfrom
Churro:fix/repository-ls-remote

Conversation

@Churro

@Churro Churro commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Changes

This PR fixes a case where git ls-remote fails during a recursive renovateRepository() call after automerge. In fetchBranchCommits(), skip injecting extraCloneOpts as -c flags when .git/HEAD already exists in localDir.

With token auth, getExtraCloneOpts() sets up http.extraHeader, which gets persisted in .git/config. Until now, the directory survived the recursive call and fetchBranchCommits added those same options again via -c, producing duplicate HTTP headers that servers reject with HTTP 400. See #42210 (comment) for details.

Context

Please select one of the following:

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository:

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ls-remote failing after automerge on Bitbucket – could not read Username – No such device or address

5 participants