将本地存储库推送到远程不会使用 GIT 推送子模块文件
我是 GIT 新手,正在努力解决这个问题。我有一个存储在存储库中的网站。该网站需要一个设置为单独存储库的主题文件夹。
我已成功使用 git submodule add 命令将主题存储库添加到我的网站。
所以现在我有一个带有主题儿童重现的网站重现。子模块的文件显示在我的网站文件夹中。
我正在尝试将整个主网站复制推送到可以工作的远程服务器,但主题(子模块)的文件不会被推送。
I'm new to GIT and am struggling with it. I've got a website that is stored in a repository. The website requires a theme folder that is setup as a separate repository.
I've used the git submodule add
command successfully to add the theme repository to my website.
So now I have a website repro with a theme child repro. The files for the submodule are showing inside my website folder.
I'm trying to push the entire main website repro to a remote server which works but the files of the theme (submodule) are not pushed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
子模块非常像一个独立的存储库 - 它不知道它是否已作为子模块包含在父存储库中。父存储库也不太了解子模块 - 只是它应该在树中的位置,子模块应该位于哪个提交以及最初从哪个 URL 克隆它......
我不认为有一个命令可以将为您推送所有子模块 - 当您更新子模块中的某些文件时,事件的顺序应该是:
这里的典型问题是在父存储库中推送一个提交,该提交引用了您尚未从子模块推送的子模块版本版本。您可能会发现创建脚本很有帮助,这样您就不会忘记任何这些步骤。
The submodule is very much like an independent respository - it knows nothing about whether it's been included as a submodule in the parent repository. The parent repository doesn't know that much about the submodule either - just where it should be in the tree, what commit the submodule should be at and what URL to initially clone it from...
I don't think there's a command that will push all your submodules for you - the sequence of events when you update some files in the submodule should be:
The typical problem here is pushing a commit in the parent repository that references a submodule version that you haven't yet pushed from the submodule version. You may find it helpful to create a script so that you don't forget any of those steps.
我只是将主题目录添加为远程目录,而不是子模块。管理您自己的分支中的文件位置。主题的后续更新应移至正确的文件夹。
现在,推送将按照您最初的预期运行。
希望这有帮助。
I would just add the themes directory as a remote - not a submodule. Manage the files' location in your own branch. Subsequent updates of the theme should get moved to the proper folder.
A push will now behave as you originally intended.
Hope this helps.