Tower Help & Support

Adding & Cloning Submodules

There are two main ways how to get a Submodule into a project:

Cloning a Project That Has Submodules

When you clone a remote repository that contains Submodules, you need to initialize and update the Submodule(s) after the cloning is done. You can either do this manually via Tower's sidebar once the cloning is finished - or you can have Tower do this automatically for you. All you need to do is check the "Initialize Submodules" option in the cloning dialog.

Please note, however, that if a Submodule requires authentication info, you will need to initialize it manually in Tower: once the super-repository finished cloning, you'll find an entry for the Submodule in the sidebar. Simply right-click it and choose the Update option.

Adding a Submodule to an Existing Project

To add a Submodule to an existing repository, you can click the + button on the bottom of the sidebar and choose Add Submodule…. You can then enter both the Submodule's URL and a path to an empty folder inside of your local repository where you want to place the Submodule.

Local Submodule URLs (Per User)
By default, a Submodule's URL is saved in the ".gitmodules" file in the root directory of your project. It's under version control like any other file and therefore is the same for every user. This also means that a username should never be part of the URL.
If the Submodule requires a personal authentication (a unique username for each user or even a unique URL altogether), the URL can be overwritten in your local, user-specifig .git/config file that will not affect the global, checked-in URL.
In Tower, this can be done in the Submodule's Configuration view: simply select the Submodule in the sidebar and switch to the "Local Config" tab on the right.