Skip to content
This documentation applies to Codacy Self-hosted

For the latest updates and improvements, see the latest Cloud documentation instead.

Submodules - How to enable them

Git Submodules allow you to keep a git repository as a subdirectory within another git repository. They are helpful in maintaining a shared configuration file for your team, which can then be applied to multiple git repositories.

Codacy supports this workflow for GitHub, Bitbucket (incl. Stash/Bitbucket Server) and GitLab.

Note

Some tools don’t search for configuration files recursively. You may need to include a configuration file in the root of your repository referencing the configuration file in the submodule.

Enabling submodules for Codacy Self-hosted

By default we do normal git clones which will not clone submodules, this it to ensure that we only clone necessary repos. However if you’re already using submodules this feature can be enabled by contacting our Support Team. After the submodules have been enabled, you will need to update the license. If your submodules are public repositories, please make sure your URL is using the HTTPS protocol. If your submodules are private, make sure your URL is using the SSH protocol.

If you already have repositories added on Codacy that have submodules:

  1. Navigate to the Repository Settings tab<
  2. Click the ‘Generate New User Key’ button for each repository

Screenshot_2019-05-16_at_15.28.55.png

Don't forget to repeat these steps every time you add new repositories containing submodules to Codacy. Alternatively, you can make this the default behavior for all new repositories by turning on ‘Add repository key to the user’ in the Administration Settings.

Screenshot_2019-05-16_at_14.24.06.png

How does this work?

When you add a repository to Codacy, it generates a new SSH key that is added to your repository using a GitHub/Bitbucket/GitLab integration. Every time Codacy needs to clone that repository, this key is used. If you are using submodules, Codacy needs to clone an additional repository it has no access to. Since there is no way of identifying the submodules of a repository before cloning it, Codacy adds the SSH keys to the user’s account, thus enabling access to all repositories the user has.

Enabling submodules for Cloud

It is only possible to enable submodules for Organization accounts.

By default we do normal git clones that will not clone submodules, this it to ensure that we only clone necessary repos. However if your organization is already using submodules these can be enabled by contacting our Support Team. If your submodules are public repositories, please make sure your URL is using the HTTPS protocol. If your submodules are private, make sure your URL is using the SSH protocol.

If you already have repositories added on Codacy that have submodules:

  1. Navigate to the Repository Settings tab
  2. Click the ‘Generate New User Key’ button for each repository

Screenshot_2019-05-16_at_15.52.00.png

How does this work?

When you add a repository to Codacy, it generates a new SSH key that is added to your repository using a GitHub/Bitbucket/GitLab integration. Every time Codacy needs to clone that repository, this key is used. If you are using submodules, Codacy needs to clone an additional repository it has no access to. Since there is no way of identifying the submodules of a repository before cloning it, Codacy adds the SSH keys to the user’s account, thus enabling access to all repositories the user has.

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

If you have a question or need help please contact support@codacy.com.

Last modified November 17, 2020