简体   繁体   English

Git推送服务器上的子模块,拉空目录

[英]Git push submodule on server, pull empty directory

Hi I am pushing my changes using git push origin production on to server #1. 嗨,我正在使用git push origin production将更改git push origin production送到服务器#1。 When I git clone origin production on server #2, I get all my files except the sub-module. 当我在2号服务器上git clone origin production时,我得到了除子模块以外的所有文件。 The sub-module is empty with no .git file. 子模块为空,没有.git文件。 I was wondering why this is, and how can I get the files to either #1) git push all files to server (this is a third party library) instead of a pointer or #2)be able to git clone that empty folder. 我想知道为什么会这样,如何将文件保存到#1) git push所有文件git push到服务器(这是第三方库)而不是指针或#2)才能git clone该空文件夹。

Server #1:
Root
   -module/
       test/   <--- third party library
          some files

Server #2:
Root
    -module/
        test/  <--- empty

So I have learned more about sub-modules. 因此,我了解了有关子模块的更多信息。 What ended up happening was I git push origin production , but with sub-modules, they don't push the code! 最终发生的是我git push origin production ,但是对于子模块,它们不推送代码! Rather, it pushes a link, the link is a pointer to the third party's repo. 而是推送一个链接,该链接是指向第三方存储库的指针。 Here is my set-up: 这是我的设置:

root/ .gitmodules

Server #1: In here I had: 服务器#1:在这里,我有:

[submodule "modules/test"]     <- declaration of submodule
path = modules/test            <- directory 
url = https://git.drupal.org/project/webform.git   <-url

Server #2: 服务器2:

When you get pull, you are just pulling the pointer of this sub-module. 当您拉动时,您只是在拉动该子模块的指针。 You have to call git sub-module init to initialize it. 您必须调用git sub-module init进行初始化。 Then git sub-module update which will call the file and clone the directory from the URL you specified in the .gitmodule file. 然后git sub-module update ,它将调用该文件,并从您在.gitmodule文件中指定的URL克隆目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM