1

I am trying to setup a git repository with a submodule repository inside it. Lets call the 2 repos: Super & Sub for this example. So I initialized the Super repo then did a git submodule add of the 2nd repo. I committed the .gitmodules file with the Super repo so that when you do a git clone --recursive it pulls the submodule down along w/ the super. Currently our urls are formatted like this:

ssh://user.name@serverUrl/path/to/repo.git

Now lets say I have 3 users: user.a, user.b and user.c. user.a adds the submodule to the super repo. user.b is the build server. when user.a adds the submodule then user.b should get the submodule as user.b (NOT user.a). The same goes for user.c when he clones super and then does a commit, the log should reflect that it was committed by user.c and not as user.a (who added the submodule). I suspect there is a way to specify the url of the submodule WITHOUT including the user.name as part of the url. Which leads me to my question. How can I properly setup my git repository such that the url does not include the username? Presumably this involved copying some keys around, I'm just curious what is the proper way to do this.

many thanks Ben

Mark Longair
  • 446,582
  • 72
  • 411
  • 327
Ben
  • 16,124
  • 22
  • 77
  • 122
  • See the solution here: http://stackoverflow.com/questions/6031494/git-submodules-and-ssh-access – Cybot Dec 17 '13 at 08:09

2 Answers2

0

Use gitolite so you can access all repos using the same user as far as the OS is concerned. Each ssh key will determine the id.

user229044
  • 232,980
  • 40
  • 330
  • 338
Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • we ended up using https://bitbucket.org/sdorra/scm-manager/wiki/Home to do this, seems to work well so far... – Ben Oct 17 '11 at 18:30
  • That will work too :) But do checkout gitolite as it gives some more neat options for permissions per branch etc. – Adam Dymitruk Oct 17 '11 at 18:35
0

Try using relative urls for submodules in a manner:

[submodule "common/sub"]
path = common/sub
url = ../common/sub
AntonK
  • 1,210
  • 1
  • 16
  • 22