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

Re: Mirror repositories for submodules

From
Matt Hunter <m@lfurio.us>
Date
Jun 5, 2026, 09:34 UTC
Message-ID
<DJ10HH5HZF0E.3000F6WUQ1M08@lfurio.us>
In-Reply-To
<87pl25r3tz.fsf@emailplus.org>
On Fri Jun 5, 2026 at 12:47 AM EDT, Benson Muite wrote:
Show 7 quoted lines
>
> For submodules, the metadata consists of the url of the repository to
> clone from.  One could have a list of absolute URLs.  The default would
> be to assume that the URLs are tried in order, and if a URL times out,
> the next one would be tried.  One may want to change the default
> ordering as a user setting, or do a ping test to get obtain content from
> the closest repository.

Another idea is for the client to attempt in a random order as a kind of load balancing.

Show 16 quoted lines
>
> As an example, for linphone-desktop, the first part of the .gitmodules
> file contains:
>
> [submodule "linphone-sdk"]
> path = external/linphone-sdk
> 	url = https://gitlab.linphone.org/BC/public/linphone-sdk.git
> [submodule "external/google/gn"]
>
> This could be updated to
>
> [submodule "linphone-sdk"]
> path = external/linphone-sdk
> 	url = https://gitlab.linphone.org/BC/public/linphone-sdk.git
>         url = https://github.com/BelledonneCommunications/linphone-sdk.git
> [submodule "external/google/gn"]
Relevant to Junio's earlier comment about aiming for a general solution:

It looks like the remote URL configuration already supports multiple URLs per a single entry. It's just that git only considers the first in the list for fetching, and will push to all.

Your proposed change to .gitmodules may be used to initialize the list of URLs for a cloned submodule's (single) initial remote? At this point, any kind of mirror management logic could generically operate on each remote's URL list.

From git-config(1):
    remote.<name>.url
        The  URL of a remote repository. See git-fetch(1) or git-push(1).
        A configured remote can have multiple URLs; in this case the first
        is used for fetching, and all are used for pushing (assuming no
        remote.<name>.pushurl is defined).  Setting this key to the empty
        string clears the list of urls, allowing you to override earlier
        config.
From gitmodules(5):
    submodule.<name>.url
        Defines a URL from which the submodule repository can be cloned.
        This may be either an absolute URL ready to be passed to
        git-clone(1) or (if it begins with ./ or ../) a location relative
        to the superproject’s origin repository.

Note that the submodule format seems to explicitly support only a single value right now. Of course, I am assuming that the implementation matches the documentation.

Previous: Benson MuiteNext: Benson Muite
Message 9 of 13 in “Mirror repositories for submodules”
  1. Benson MuiteJun 1, 2026
  2. Junio C HamanoJun 4, 2026
  3. Simon RichterJun 4, 2026
  4. Jeff KingJun 4, 2026
  5. Simon RichterJun 4, 2026
  6. Jeff KingJun 8, 2026
  7. Benson MuiteJun 5, 2026
  8. Benson MuiteJun 5, 2026
  9. Matt HunterJun 5, 2026
  10. Benson MuiteJun 5, 2026
  11. Simon RichterJun 5, 2026
  12. Benson MuiteJun 5, 2026
  13. Benson MuiteJun 5, 2026

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.