Mar*_*ark 1864 git git-submodules
我试图将子模块放入回购.问题是当我克隆父repo时,子模块文件夹是完全空的.
有没有办法让它git clone parent_repo
实际上把数据放在子模块文件夹中?
例如,http://github.com/cwolves/sequelize/tree/master/lib/,nodejs-mysql-native
指向在外部git的子模块,但是当我结账的sequelize
项目,该文件夹为空.
Mat*_*ens 2843
使用Git及更高版本的2.13版本,--recurse-submodules
可以代替--recursive
:
git clone --recurse-submodules -j8 git://github.com/foo/bar.git
cd bar
Run Code Online (Sandbox Code Playgroud)
编者注:-j8
可选的性能优化在2.8版本中可用,并且一次最多可以获取8个子模块 - 参见man git-clone
.
使用版本1.9的Git直到版本2.12(-j
仅在2.8+版本中提供标记):
git clone --recursive -j8 git://github.com/foo/bar.git
cd bar
Run Code Online (Sandbox Code Playgroud)
使用Git及更高版本的1.6.5版,您可以使用:
git clone --recursive git://github.com/foo/bar.git
cd bar
Run Code Online (Sandbox Code Playgroud)
对于已经克隆的repos或较旧的Git版本,请使用:
git clone git://github.com/foo/bar.git
cd bar
git submodule update --init --recursive
Run Code Online (Sandbox Code Playgroud)
Lir*_*una 463
在填充子模块之前,您必须做两件事:
git submodule init
git submodule update
Run Code Online (Sandbox Code Playgroud)
Von*_*onC 196
原答案2010
正如joschi在评论中提到的,git submodule
现在支持--recursive
选项(Git1.6.5及更多).
如果
--recursive
指定,则此命令将递归到已注册的子模块中,并更新其中的任何嵌套子模块.
请参阅init部分递归使用git子模块.
请参阅git submodule
解释更多信息.
使用1.6.5版本的git及更高版本,您可以通过使用以下
–-recursive
选项克隆超级项目来自动执行此操作:
git clone --recurse-submodules --remote-submodules
Run Code Online (Sandbox Code Playgroud)
使用git 2.8更新2016:请参阅" 如何使用git clone --recursive
?加速/并行化git子模块的下载? "
您可以并行使用多个线程启动子模块.
为实例:
git clone --recurse-submodules
Run Code Online (Sandbox Code Playgroud)
Jav*_* C. 65
您可以使用此命令克隆包含所有子模块的repo:
git clone --recursive YOUR-GIT-REPO-URL
Run Code Online (Sandbox Code Playgroud)
或者,如果您已经克隆了项目,则可以使用:
git submodule init
git submodule update
Run Code Online (Sandbox Code Playgroud)
Mar*_*yne 31
如果您的子模块已添加到分支中,请务必将其包含在克隆命令中...
git clone -b <branch_name> --recursive <remote> <directory>
Run Code Online (Sandbox Code Playgroud)
nwe*_*ler 28
试试这个:
git clone --recurse-submodules
Run Code Online (Sandbox Code Playgroud)
假设您已将子模块添加到父项目,它会自动提取子模块数据.
小智 23
我想你可以用3个步骤,
git clone
git submodule init
git submodule update
Run Code Online (Sandbox Code Playgroud)
kai*_*ser 20
迟到的答案
// git CLONE INCLUDE-SUBMODULES ADDRESS DESTINATION-DIRECTORY
git clone --recursive https://USERNAME@bitbucket.org/USERNAME/REPO.git DESTINATION_DIR
Run Code Online (Sandbox Code Playgroud)
因为我花了整整一个小时与朋友一起摆弄:即使你拥有BitBucket的管理员权限,也要克隆ORIGINAL存储库并使用拥有repo的人的密码.很恼火,发现你遇到了这个陷阱:P
小智 18
试试这个在git仓库中包含子模块.
git clone -b <branch_name> --recursive <remote> <directory>
Run Code Online (Sandbox Code Playgroud)
要么
git clone --recurse-submodules
Run Code Online (Sandbox Code Playgroud)
Ahm*_*imi 15
--recursive
克隆存储库时可以使用参数.此参数强制git克隆repo中所有已定义的子模块.
git clone --recursive git@repo.org:your_repo.git
Run Code Online (Sandbox Code Playgroud)
克隆后,有时子模块分支可能会发生变化,因此请在之后运行此命令:
git submodule foreach "git checkout master"
Run Code Online (Sandbox Code Playgroud)
Ben*_*ari 14
克隆父仓库(包含一些子模块仓库)后,请执行以下操作:
git submodule update --init --recursive
Run Code Online (Sandbox Code Playgroud)
Ant*_*ons 14
使用此命令克隆所有子模块的 repo
git clone --recurse-submodules git@gitlab.staging-host.com:yourproject
Run Code Online (Sandbox Code Playgroud)
更新所有子模块的代码
git submodule update --recursive --remote
Run Code Online (Sandbox Code Playgroud)
小智 11
子模块并行提取旨在通过一次启用多个存储库的获取来减少获取存储库及其所有相关子模块所需的时间.这可以通过使用新的--jobs选项来完成,例如:
git fetch --recurse-submodules --jobs=4
Run Code Online (Sandbox Code Playgroud)
根据Git团队的说法,这可以大大加快更新包含许多子模块的存储库.当使用没有新的--jobs选项的--recurse-submodules时,Git将逐个获取子模块.
资料来源:http://www.infoq.com/news/2016/03/git28-released
小智 7
我对GitHub存储库有同样的问题。我的帐户缺少SSH密钥。这个过程是
然后,您可以使用子模块(git clone --recursive YOUR-GIT-REPO-URL
)克隆存储库
要么
运行git submodule init
并git submodule update
在已克隆的存储库中获取子模块。
小智 5
尝试这个。
git clone -b <branch_name> --recursive <remote> <directory>
Run Code Online (Sandbox Code Playgroud)
如果已将子模块添加到分支中,请确保将其添加到clone命令。
If it is a new project simply you can do like this :
$ git clone --recurse-submodules https://github.com/chaconinc/YourProjectName
Run Code Online (Sandbox Code Playgroud)
If it is already installed than :
$ cd YourProjectName (for the cases you are not at right directory)
$ git submodule init
$ git submodule update
Run Code Online (Sandbox Code Playgroud)
只需在您的项目目录中执行这些操作。
$ git submodule init
$ git submodule update
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
783576 次 |
最近记录: |