Re: Submodule using different repository URLs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johan,

On 13.07.2009, at 12:59, Johan Herland wrote:

On Monday 13 July 2009, Peter Voss wrote:
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@xxxxxxxxxx: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?

You might be able to pull this off using relative submodule URLs. If the
submodule URLs in .gitmodules are relative (i.e. ../foo.git or
similar), they will be resolved to absolute URLs using the origin URL
of the super-repo. I.e. if you cloned the super-repo from
git://github.com/x/mymodule.git, the ../foo.git submodule will be
cloned from git://github.com/x/foo.git, and if you cloned from
git@xxxxxxxxxx:x/mymodule.git, the submodule will be cloned from
git@xxxxxxxxxx:x/foo.git.

That's a good hint. Unfortunately I can't use this to go up 2 directories. I.e. I can't get from
git@xxxxxxxxxx:xxx/mymodule.git
to
git@xxxxxxxxxx:yyy/foo.git

Using the relative URL ../../yyy/foo.git leads to the result:
Clone of 'git@xxxxxxxxxx:xxx/yyy/foo.git' into submodule path 'foo' failed

So I basically cannot replace the xxx part.

Anyway, thanks for the hint.
--Peter

Hope this helps,


Have fun! :)

...Johan


--
Johan Herland, <johan@xxxxxxxxxxx>
www.herland.net

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]