threads / discuss / 38853

submodule.$name.url is ignored during submodule update

Subject: submodule.$name.url is ignored during submodule update

## tl;dr

4 messages between Mar 19, 2015 and Mar 19, 2015.

replies: 3people: 2as markdown or json

Dmitry Neverov· Mar 19, 2015, 09:27 UTC · lore
Hi,

I've noticed that the 'submodule.$name.url' config parameter from the main repository is ignored when a submodule needs to be updated, the submodule's 'remote.origin.url' is used instead. Is there any way to customize the submodule url for both the initial clone and for updates?

-- Dmitry

Doug Kelly· Mar 19, 2015, 13:09 UTC · re: Dmitry Neverov · lore

Re: submodule.$name.url is ignored during submodule update

On Thu, Mar 19, 2015 at 4:27 AM, Dmitry Neverov <dmitry.neverov@gmail.com> wrote:

Show 7 quoted lines
> Hi,
>
> I've noticed that the 'submodule.$name.url' config parameter from the
> main repository is ignored when a submodule needs to be updated, the
> submodule's 'remote.origin.url' is used instead. Is there any way to
> customize the submodule url for both the initial clone and for
> updates?

That's what "git submodule sync" is for. It will synchronize the url in .gitmodules with to the remote.origin.url for each submodule. I'm not sure about the second part of your question: are you talking about using different URLs for the initial clone and updates?

Dmitry Neverov· Mar 19, 2015, 13:16 UTC · re: Doug Kelly · lore

Re: submodule.$name.url is ignored during submodule update

I want to use a custom url for both initial submodule clone and submodule update. Git submodule man page states that if I run 'git submodule init' and then change the 'submodule.$name.url' in the main repository config, git will use this url instead of url in .gitmodules. Git does use the custom url for initial submodule clone, but doesn't use it when cloned submodule needs to be updated. Is that by design?

On Thu, Mar 19, 2015 at 2:09 PM, Doug Kelly <dougk.ff7@gmail.com> wrote:
Show 16 quoted lines
> On Thu, Mar 19, 2015 at 4:27 AM, Dmitry Neverov
> <dmitry.neverov@gmail.com> wrote:
>> Hi,
>>
>> I've noticed that the 'submodule.$name.url' config parameter from the
>> main repository is ignored when a submodule needs to be updated, the
>> submodule's 'remote.origin.url' is used instead. Is there any way to
>> customize the submodule url for both the initial clone and for
>> updates?
>
> That's what "git submodule sync" is for. It will synchronize the url
> in .gitmodules with
> to the remote.origin.url for each submodule.  I'm not sure about the second part
> of your question: are you talking about using different URLs for the
> initial clone
> and updates?
Dmitry Neverov· Mar 19, 2015, 21:29 UTC · re: Dmitry Neverov · lore

Re: submodule.$name.url is ignored during submodule update

Sorry, my bad. I thought 'git submodule sync' changes only 'submodule.$name.url' in main repository config, but it also changes the 'remote.origin.url' in submodule's config. I indeed ran 'git submodule sync', that's why the default url was used even though 'submodule.$name.url' had a different value.

On Thu, Mar 19, 2015 at 2:16 PM, Dmitry Neverov <dmitry.neverov@gmail.com> wrote:

Show 25 quoted lines
> I want to use a custom url for both initial submodule clone and
> submodule update. Git submodule man page states that if I run 'git
> submodule init' and then change the 'submodule.$name.url' in the main
> repository config, git will use this url instead of url in
> .gitmodules. Git does use the custom url for initial submodule clone,
> but doesn't use it when cloned submodule needs to be updated. Is that
> by design?
>
> On Thu, Mar 19, 2015 at 2:09 PM, Doug Kelly <dougk.ff7@gmail.com> wrote:
>> On Thu, Mar 19, 2015 at 4:27 AM, Dmitry Neverov
>> <dmitry.neverov@gmail.com> wrote:
>>> Hi,
>>>
>>> I've noticed that the 'submodule.$name.url' config parameter from the
>>> main repository is ignored when a submodule needs to be updated, the
>>> submodule's 'remote.origin.url' is used instead. Is there any way to
>>> customize the submodule url for both the initial clone and for
>>> updates?
>>
>> That's what "git submodule sync" is for. It will synchronize the url
>> in .gitmodules with
>> to the remote.origin.url for each submodule.  I'm not sure about the second part
>> of your question: are you talking about using different URLs for the
>> initial clone
>> and updates?

← back to recent threads