Re: Submodule using different repository URLs
- From
Peter Voss <info@petervoss.org>
- Date
- Jul 13, 2009, 12:04 UTC
- Message-ID
- <EDAD14B2-414A-436B-BA85-CBD9A13B2B87@petervoss.org>
- In-Reply-To
- <adf1fd3d0907130320s726bb80at58d454c830c7d5be@mail.gmail.com>
Hi Santi,
On 13.07.2009, at 12:20, Santi Béjar wrote:
Show 44 quoted lines
> 2009/7/13 Peter Voss <info@petervoss.org>: >> 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.
I didn't get the insteadOf config running (maybe I have to update to a more recent version of git). But modifying the URL in .git/config should be a doable approach for us. In order to add the insteadOf section we would have to edit the .git/config file as well, so that doesn't seem to be much better.
Thanks for your help, --Peter
> HTH, > Santi