1

I have a project with the following structure:

ProjA
Controllers
Models
Subprojects
     /SubProject1
     /SubProject1

I want to make it so that when someone clones ProjA that it brings down the git repos for SubProject1 and SubProject2.

I attempted to do this using git submodule like so:

git submodule add https://github.com/myAccount/ProjA Subprojects/SubProject1

And that seemed to work but when I pulled down ProjA to a new directory my SubProjects were empty. When I go back to the original and look at the results of git status it shows:

modified:   Subprojects/SubProject1 (modified content)
modified:   teSubprojectst/SubProject2 (modified content, untracked content)

Doing a git commit... doesn't seem to change anything. Have I missed a step along the way that would allow me to include those directories in the parent repo?

NOTE I just noticed that when I try to navigate to the subprojects in github it throws a 404 error. Not sure if I messed something up when I created them using submodule? When I attempt to use --recurse-submodules I get a not found error.

Abe Miessler
  • 82,532
  • 99
  • 305
  • 486

1 Answers1

2

I believe you need to recurse on the submodules when you are cloning.

git clone --recurse-submodules https://github.com/myAccount/ProjA

Check out the docs for it here: https://git-scm.com/book/en/v2/Git-Tools-Submodules

Jonathan Wang
  • 317
  • 3
  • 13
  • So I just noticed that when I attempt to navigate to the subprojects in github I get a 404 error - I can no longer view the content of those folders... When I attempt to do this it prompts me to log in for each project and fails with my credentials – Abe Miessler Apr 14 '19 at 19:39