Git deployment with submodules

I studied different ways to deploy sites using git and found the following tutorial:

http://42pixels.com/blog/quick-and-dirty-git-deployment

I like the ideas presented in this tutorial and I will strive to use it for my sites, but it does not seem to support submodules.

In any case, can this be changed so that the submodules are also retracted and updated as necessary?

Thanks.

UPDATE

I have been working on this issue for the last couple of hours, and I seem to be making progress, but I still can't get it to work.

I switched to this tutorial: http://toroid.org/ams/git-website-howto (this is basically the same, with just a few minor changes), and after following some tips found here: https://stackoverflow.com/a/3/2/2/ 473360 / ... I ended up with a post-receive file that looks like this:

#!/bin/sh export GIT_WORK_TREE=/srv/www/limeblast.co.uk/htdocs_test export GIT_DIR=/srv/www/limeblast.co.uk/.git cd $GIT_WORK_TREE git checkout -f master git submodule init git submodule update 

All this seems perfect in theory, and it would seem that the submodular commands are running, but I get the following error messages:

remote: Submodule 'wordpress' (git: //github.com/WordPress/WordPress.git) registered for the path 'wordpress' remote: Submodule 'wp-content / themes / limeblastevolution / inc / cssCrush' (git: // github .com / peteboere / css-crush.git) registered for the path 'wp-content / themes / limeblastevolution / inc / cssCrush' remote: fatal: working tree '/srv/www/limeblast.co.uk/htdocs_test' already exists . remote: Clone of git: //github.com/WordPress/WordPress.git 'the submodule path "wordpress" failed

Any ideas? Thanks.

+6
source share
1 answer

You may have success with git-deploy .

But if this is too focused on Rails or if you cannot or will not use it for other reasons, here's how to force the submodule to be updated in the hook after committing:

 git submodule init && git submodule sync && git submodule update 

You must run this on the server; so it is probably best to add it to your hooks/post-receive script. It is just BASH or SH, bytheway.

+6
source

Source: https://habr.com/ru/post/915516/


All Articles