Git子模块具有独立的work_tree [英] Git submodules with separate work_tree

查看:116
本文介绍了Git子模块具有独立的work_tree的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照这个页面上的教程来简单地通过Git部署我的网站: http:// toroid.org/ams/git-website-howto 。直到现在它都很好,但是我最近开始使用Kohana并按照这个教程在Git中设置它: http://kohanaframework.org/3.1/guide/kohana/tutorials/git



我的问题是:当我推动我的Web服务器,没有部署子模块。所以,我怎样才能将子模块拉到我的网络服务器上的工作树上?



如果我运行

<$ p $ git --git-dir /srv/www/mysite.com/src/project.git --work-tree /srv/www/mysite.com/public_html submodule init

它表示

 致命:工作树'/srv/www/mysite.com/public_html'已经存在
将'git://github.com/kohana/auth.git'克隆到子模块路径'modules / auth'failed`中。

有谁知道如何检出这些子模块?如果我找不到一种方法,我将不得不手动将它们进行FTP传输,这并不理想。

您需要分开推动子模块。子模块是他们自己的仓库。



一个简单的人会去这里

  git子模块for-each git push 

(_ add the - - 递归标志使它真的可以用于类固醇)



你需要自己去寻找这是否是你想要的。另外,请注意,默认情况下,每个子模块将推送到它指定的上游(推送分支)。您也可以获取


<在接收工作树内:

  git子模块更新

第一个你可能要

  git submodule init 


I followed the tutorial on this page to make deploying my websites via Git simple: http://toroid.org/ams/git-website-howto. Up til now it's being fine, however I've recently started using Kohana and followed this tutorial to set it up in Git: http://kohanaframework.org/3.1/guide/kohana/tutorials/git.

My problem is: when I push to my web server, none of the submodules are deployed. So, how can I pull the submodules into my working tree on my webserver?

If I run

git --git-dir /srv/www/mysite.com/src/project.git --work-tree /srv/www/mysite.com/public_html submodule init

it says

fatal: working tree '/srv/www/mysite.com/public_html' already exists
Clone of 'git://github.com/kohana/auth.git' into submodule path 'modules/auth' failed`.

Does anyone know how to checkout these submodules? If I can't find a way I'll have to resort to manually FTPing them up which isn't ideal.

解决方案

You need to push the submodules separately. Submodules are their own repositories.

A simpleminded go at this would be

git sub-module for-each git push

(_add the --recursive flag to make it really work on steroids)

You'd have to look for yourself whether this is what you desire. Also, note that each submodule will push to it's designated upstream (push branch) by default

You can also fetch

Within the receiving worktree:

git submodule update

The first you may have to

git submodule init

这篇关于Git子模块具有独立的work_tree的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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