4

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?

Pluffee
  • 155
  • 1
  • 8
eonj
  • 109
  • 1
  • 1
  • 12

1 Answers1

8

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

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks. So it's because there is no `gitlink` object... Then **why** does `.gitmodules` exist, while `.git/config` is what really works? – eonj Jul 03 '13 at 07:45
  • 1
    @Uni- because `.git/config` is purely a *local* configuration which isn't pushed/pulled. `.gitmodules` is a file which *declares* those submodules, part of the repo, pushed to other repos, and allowing any local repo cloning that file to build back its local `.git/config` with said submodules. – VonC Jul 03 '13 at 07:59