git submodules as part of a build
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
Try using relative urls for submodules in a manner:
[submodule "common/sub"]
path = common/sub
url = ../common/sub
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.
精彩评论