问题
I often use this pattern for easy deployment of websites:
I have a bare repo, which I push/pull to from my computer and this bare repo has a post-update hook that automatically does a pull in another repo (the live version).
However, if I add a submodule on my computer and push it, I have to manually connect to the remote and do the init/update.
Is there a way around it ?
回答1:
Do you have the ability to do more than a pull on the live server? You can do all of that in one (well, technically two) command:
git pull && git submodule update --init --recursive
This will recursively initialise and pull any submodules, and update existing submodules.
Hope that helps.
来源:https://stackoverflow.com/questions/8271839/how-can-i-init-update-git-submodules-in-a-remote