2

I wanted to add some folder in my current git repo.

but i have received such green folder in the github the following image . How to add this folder into this project.Green folder git

kostix
  • 51,517
  • 14
  • 93
  • 176
Nilesh Agrawal
  • 3,002
  • 10
  • 26
  • 54

3 Answers3

4

I believe the green folders represent submodules on github. A submodule is essentially a link to a version of another repo.

To get the submodules locally run:

git submodule init
git submodule update

You can read more about submodules here: http://git-scm.com/book/en/Git-Tools-Submodules

Craig MacGregor
  • 4,589
  • 1
  • 21
  • 13
  • how to add this submodule as regular folder to my project. – Nilesh Agrawal Apr 30 '13 at 13:55
  • Once you have the submodule sources locally you can remove the submodule from the repo and then just add the sources normally. But it's a little tricky to remove a submodule. See this question: http://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule – Craig MacGregor Apr 30 '13 at 14:00
2

That folder icon is how Github shows submodules

A submodule is essentially a reference to another repository (specifically, a specific commit in another repository)

There should be a .gitmodules file at the root of the repository, containing something like this:

$ cat .gitmodules
[submodule "ca_log_analysis"]
      path = ca_log_analysis
      url = git://github.com/example/ca_log_analysis_repo.git

You could commit your changes to that linked repository, then update the master project to look at the new commit. The Git book chapter on submodules should explain things

dbr
  • 165,801
  • 69
  • 278
  • 343
0

From memory, Git doesn't recognise empty folders. Do you have anything in it? If not, add a README or something too.

lizard
  • 191
  • 1
  • 4