Adding and Cloning Submodules
Learn the commands to add a new submodule to a project and how to properly clone a repository with submodules.
Add & Clone Git Submodules
Git submodules let you embed one Git repository inside another. This is useful for managing external dependencies like libraries or shared components.
In this lesson, we'll learn how to add a new submodule to your project and how to properly clone a repository that contains submodules.
The `git submodule add` Command
To add a submodule, you use the git submodule add command. This command takes the URL of the external repository and optionally a local path where you want to place it.
- Repository URL: The URL (HTTPS or SSH) of the submodule's Git repository.
- Path: The directory within your main project where the submodule will reside. If omitted, Git uses the repository name.
All lessons in this course
- Introduction to Git Submodules
- Adding and Cloning Submodules
- Updating and Synchronizing Submodules
- Removing and Deinitializing Submodules