Dachande663
Dachande663

Reputation: 503

Git submodules with separate work_tree

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.

Upvotes: 4

Views: 1816

Answers (2)

Mauvis Ledford
Mauvis Ledford

Reputation: 42354

Try CD'ing into the submodule directory and just doing a git push.

Make sure you did git submodule init and git submodule update in the root project folder when you enabled the submodule.

Upvotes: 0

sehe
sehe

Reputation: 393124

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

Upvotes: 1

Related Questions