eonj
eonj

Reputation: 119

Git submodules in .gitmodules not initialized

https://github.com/Uni-/shBrushesCollection

I created a GitHub repository and made a .gitmodules file directly from GitHub's web source editor. When I then cloned the repo, I noticed the submodules in .gitmodules were not being initialized.

I think I tried almost all commands possible, including update, init, update --init and so on. Is there a way to use current .gitmodules file, not submodules add?

Upvotes: 5

Views: 11680

Answers (2)

ergohack
ergohack

Reputation: 1378

.gitmodules exists,
✓ submodule directory exists,
✗ but no files or sub-directories are in the submodule directory, ...

git submodule update --init is required, once, for this remote clone.

Upvotes: 0

VonC
VonC

Reputation: 1329662

Writing a submodule isn't enough.

You should rather use git submodule add: that will update your .gitmodules file and create a special entry in the index (where you want that submodule to be loaded).

Then, when you push that to your upstream repo on GitHub, the project page will display those special entries as a green folder.

green folder

Upvotes: 8

Related Questions