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 (including 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 is 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:
- Navigate to the Repository Settings tab
-
Click the 'Generate New User Key' button for each repository.
If you're using Bitbucket Cloud, you must click the link 'Add New User Key' instead and manually copy the SSH key to Bibucket Cloud.
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. If you're using Bitbucket Cloud, since automatically adding the user keys is not supported this setting must be disabled.
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 is 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:
- Navigate to the Repository Settings tab
- Click the 'Generate New User Key' button for each repository
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?
255 characters left
We're sorry to hear that. Please let us know what we can improve:
255 characters left
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.