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

Re: Submodule using different repository URLs

From
SBSanti Béjar <santi@agolina.net>
Date
Jul 13, 2009, 10:20 UTC
Message-ID
<adf1fd3d0907130320s726bb80at58d454c830c7d5be@mail.gmail.com>
In-Reply-To
<5BE6F3DC-4B00-4D84-8D0E-41057735483F@petervoss.org>
2009/7/13 Peter Voss <info@petervoss.org>:
Show 20 quoted lines
> Hi,
>
> I want to use the git submodule feature to move part of my code to a
> different repository at github.
>
> The issue is that developers should use different repository URLs for the
> submodule depending on whether they have commit rights or not.
>
> At the beginning I was using the public URL to set-up the submodule:
> git submodule add git://github.com/x/mymodule.git mymodule
>
> The issue is that some developers are working behind a firewall that blocks
> the git protocol. These could only use the git@github.com:x/mymodule.git URL
> to get access.
> But other developers can only go through the public URL
> git://github.com/x/mymodule.git. So whatever I use it won't work for
> everybody.
>
> What's the best way to deal with that? Could I set-up different repository
> URLs for one and the same submodule and use which one is appropriate?

After the "git submodule init" you can customize the url. From "man git-submodule":

init::
        Initialize the submodules, i.e. register each submodule name
        and url found in .gitmodules into .git/config.
        The key used in .git/config is `submodule.$name.url`.
        This command does not alter existing information in .git/config.
        You can then customize the submodule clone URLs in .git/config
        for your local setup and proceed to 'git submodule update';
        you can also just use 'git submodule update --init' without
        the explicit 'init' step if you do not intend to customize
        any submodule locations.

You can also use the config url."<actual url base>".insteadOf = <other url base>. See the git-pull manpage for examples.

HTH, Santi

Previous: Peter VossNext: Peter Voss
Message 2 of 8 in “Submodule using different repository URLs”
  1. Peter VossJul 13, 2009
  2. Santi BéjarJul 13, 2009
  3. Peter VossJul 13, 2009
  4. Johan HerlandJul 13, 2009
  5. Peter VossJul 13, 2009
  6. Johan HerlandJul 13, 2009
  7. Johan HerlandJul 13, 2009
  8. Peter VossJul 13, 2009

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.