git的子模块作为构建的一部分 [英] git submodules as part of a build

查看:136
本文介绍了git的子模块作为构建的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用设置里面的子模块库一个Git仓库。让我们称之为2回购:超级&放大器;子的这个例子。所以我初始化超级回购,然后做了一个 git的子模块添加第二回购。我犯的超级回购的 .gitmodules 文件,这样当你做一个 git的克隆--recursive 它拉子模块顺着瓦特/超。目前,我们的网址的格式如下:

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

现在可以说我有3个用户: user.a user.b user.c的 user.a 添加子​​模块超级回购。 user.b 是构建服务器。当 user.a 添加子​​模块则 user.b 应该得到的子模块为用户。 b (不 user.a )。这同样适用于 user.c的时,他克隆超,然后就提交,日志应该反映它是由 user.c的,而不是 user.a (谁添加的子模块)。我怀疑有指定子模块的URL,而不包括user.name作为URL的一部分的方法。这使我对我的问题。我怎样才能正确设置我的git仓库,使URL不包含用户名? presumably这涉及复制周围的一些按键,我只是好奇什么是做到这一点的正确方法。

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.

非常感谢

推荐答案

使用gitolite这样你就可以使用相同的用户只要操作系统而言访问所有回购。每个ssh密钥将决定ID。

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.

这篇关于git的子模块作为构建的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆