5

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?

Larry K
  • 47,808
  • 15
  • 87
  • 140
  • 1
    Have you cloned the submodules yet? `git clone --recursive ` or if you've already cloned the super project `git submodule update` – Peter Lundgren May 17 '13 at 12:53
  • I've now tried to clone as you suggest. But git complained since the dir had been filled when I did the submodule add. So I've given up on submodules and just did the clone. Thanks. – Larry K May 18 '13 at 18:31

1 Answers1

7

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).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250