Larry K
Larry K

Reputation: 49104

git submodule not fetched by repo checkout

I'm a git newbie. My git repo includes submodule references. I have a post-receive hook to checkout the repo contents to my web directory:

#!/bin/sh
GIT_WORK_TREE=/home/www/hello_world_php git checkout -f

(Per this blog post.)

It works fine except that the submodule directories in the www directory are NOT populated.

How to fix?

Upvotes: 5

Views: 2458

Answers (1)

VonC
VonC

Reputation: 1324258

For a cloned repo, what I do when I see I don't have anything in .git/modules/xxx, is:

git submodule update --init --recursive

See my script for an example.

If you don't, all you have is an empty directory representing your submodule root, and stored in your working tree as a special entry (mode 160000).

Upvotes: 8

Related Questions