Submodules - How to enable them

Git Submodules allow keeping 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 Enterprise

Submodules are enabled by our Support team because this prevents repositories with submodules from getting reviewed. After the submodules are enabled, you will have to update the licenseNow, if your submodules are public repositories make sure the URL is using the HTTPS protocol.

If your submodules are on private repositories, make sure the URL is using the SSH protocol. If you already have projects added on Codacy that have submodules, for each one then:

  1. Navigate to the Project Settings tab
  2. Click the ‘Generate New User Key’ button

Screen_Shot_2018-06-01_at_16.15.20.png

Don't forget you'll have to repeat these steps every time you’re adding new projects containing submodules to Codacy. Alternatively, you can make this the default behavior by turning on ‘Add project key to the user’ in Administration Settings.

 

Screen_Shot_2018-06-01_at_17.19.53.png

How does it work?

When you add a project to Codacy, it generates a new SSH key that is then 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, to make sure Codacy keys have the required access to a repository and all its submodules, it adds the SSH keys to the user’s account, thus having access to all repositories the user has.

 


Enabling submodules for Cloud

Submodules are enabled by our Support team because this prevents repositories with submodules from getting reviewed. Once submodules have been enabled, and if your submodules are on public repositories, make sure the URL is using the HTTPS protocol.

If your submodules are private repositories, make sure the URL is using the SSH protocol. If you already have projects on Codacy containing submodules, for each one then:

  1. Navigate to the Project Settings tab
  2. Click the ‘Generate New User Key’ button

Screen_Shot_2018-06-01_at_16.15.20.png

 

How does it work?

When you add a project to Codacy, it generates a new SSH key that is then added to your repository using a GitHub/Bitbucket/GitLab integration. Everytime 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, to make sure Codacy keys have the required access to a repository and all its submodules, it adds the SSH keys to the user’s account, thus having access to all repositories the user has.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.