Lena Bru
Lena Bru

Reputation: 13947

Cloning a git repo that has submodules

I have a git repot that has a submodule.

I want to clone this repo into an eclipse workspace, I've read this

Working with Submodules

You can read more about what Git submodules are and how they work in this Git Community Book chapter.
Cloning Repositories with Submodules
Submodules are repositories nested inside a parent repository.
Therefore when doing a clone of a parent repository it is necessary to clone the submodule repositories so that the files/folders are available in the parent repository's working directory.

Checking the Clone Submodules button from the Git Clone wizard will clone all submodule repositories after the clone of the parent repository finishes.

enter image description here

However, when I am done cloning, the submodule directory is empty and the project doesnt appear in the workspace.

How do I add the submodule ?

Upvotes: 5

Views: 7046

Answers (2)

pappu_kutty
pappu_kutty

Reputation: 2488

in eclipse go to git explorer perspective

you can import you project modules under you project

project> working directory > select sub module > import project.
  >> Import as general project (for new)
  >> Import existing project (which will replace you current project)

if you have 3 modules you need to import one by one. as existing module or new one

Upvotes: 1

Thinsky
Thinsky

Reputation: 4246

  1. git clone yourProjectUrl.
  2. in your project folder: git submodule init (only do it first time)
  3. you can also update submodule: git submodule update.

Upvotes: 0

Related Questions