git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* issue with git submodules and a clone.defaultRemoteName different than origin?
@ 2025-06-03 23:06 Jacob Keller
  2025-06-03 23:42 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jacob Keller @ 2025-06-03 23:06 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List

Hi,

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

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-07  5:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 23:06 issue with git submodules and a clone.defaultRemoteName different than origin? Jacob Keller
2025-06-03 23:42 ` Junio C Hamano
2025-06-04 17:18   ` Jacob Keller
2025-06-06 21:29     ` Jacob Keller
2025-06-06 23:32       ` Junio C Hamano
2025-06-07  5:43         ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).