git/list[1] front-page[2] threads[3] people[4] search[5] about
 

issue with git submodules and a clone.defaultRemoteName different than origin?

From
Jacob Keller <jacob.e.keller@intel.com>
Date
Jun 3, 2025, 23:06 UTC
Message-ID
<4f638125-39e0-43a1-9c58-35c2d433042f@intel.com>
Hi,

I recently ran into an issue with git submodules because my clone.defaultRemoteName is not "origin":

Show 6 quoted lines
> fatal: 'origin' does not appear to be a git repository
> fatal: Could not read from remote repository.
> 
> Please make sure you have the correct access rights
> and the repository exists.
> fatal: Fetched in submodule path 'submodule', but it did not contain <redacted>. Direct fetching of that commit failed.

This appears to be due to the builtin/submodule--helper hard coding "origin" in "repo_get_default_remote".

I am unsure what the best way to fix this is. I could have the function read the clone.defaultRemoteName, or I could have it check if there is only one remote then use that.. or maybe add a new submodule remote name option?

Thoughts on what the best solution is here?
I'm thinking the following:
1) check if there is only one remote, then use that
2) check clone.defaultRemoteName and use that otherwise
3) fall back to origin otherwise?

Perhaps we could insert a step 0 where we add a config option which will have submodule clones use the given remote name + use that as the default when in detached head state?

Thanks, Jake

Next: Junio C Hamano
Message 1 of 6 in “issue with git submodules and a clone.defaultRemoteName different than origin?”
  1. Jacob KellerJun 3, 2025
  2. Junio C HamanoJun 3, 2025
  3. Jacob KellerJun 4, 2025
  4. Jacob KellerJun 6, 2025
  5. Junio C HamanoJun 6, 2025
  6. Patrick SteinhardtJun 7, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.