0

I created a repository in Github and was trying to upload some Python code there. One of the sub-folder is uploaded empty which I don't reason out. I created new repository with different name and still facing the same issue. Later, I remove the origin using git remote rm origin and dont see any effect for that. Here is the picture for the upload,

enter image description here

The folder name with some code is ML Examples and it uploaded as empty. I was tried to change the name to ML earlier and deleted later on. However, it still shows in the upload.

What's the issue here and how to solve it ?

Arefe
  • 11,321
  • 18
  • 114
  • 168

2 Answers2

2

What you see (gray folder) is a gitlink, a special entry in the index of your main GitHub repo which records the nested repo root SHA1.

If you want to reference its content as well, you should add those nested repos as submodules.

Or you should avoid for those subdirectories to have a .git/ folder in them, as that would make them nested git repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • One question, why does all the sub-folder is uploaded but the ML Examples ? I need good explanation on that. – Arefe Feb 26 '17 at 15:27
  • Because MK Example includes a .git folder in it, making it a nested git repo. In that case, your main repo only records a gitlink, which is what you see on GitHub. – VonC Feb 26 '17 at 15:41
0

AFAIU git don't really care about directories, only about files inside them.

That is, you need to git add somedir/somefile

(but I am a newbie on git and could be wrong)

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • You are correct: Git does not record empty directories, in that it does not really record directories at all, except by implication (i.e, a file named `a/b/c` implies that directories `a` and `a/b` must exist). In this case, however, VonC is right (as always :-) ): what the questioner created is a "gitlink" entry, which is essentially a file containing a commit hash ID for a submodule. GitHub displays these specially because Git checks out the submodule (provided you have set up the *rest* of the requirements for submodules). – torek Feb 26 '17 at 21:50