Regardless of where your repository is hosted, if it's Internet-accessible, it can be analyzed by Code Climate. This article covers the two ways you can add new repos to your Dashboard, and begin improving your code quality:
If you're trying to add an open source GitHub repository, check out our Adding an Open Source GitHub Repository doc.
You must be in an organization's Owners group to perform the actions described in this article.
If your Code Climate user is linked to your GitHub user, adding your private GitHub repository takes only a few clicks.
- From your Dashboard, within the organization you want to add the repository to, click Add a Repo.
- Next to the repository you want to add, click Add Repo.
Don't see your repository? The repository must be associated with your GitHub user account or your GitHub organization account(s).
If you've recently made changes in GitHub that should result in a new repository appearing in Code Climate, click Sync Now from your Code Climate Dashboard.
You may want to use this method if:
- You don't use GitHub. No problem! Via a URI, you can add a repository hosted on Bitbucket, GitLab, or even your own DIY Git server.
- You use GitHub, but don't want your Code Climate user linked to your GitHub user. That's fine with us! Just enter a URI. In doing so, you'll essentially bypass Code Climate's more streamlined GitHub repository setup process.
GitHub Repository Not Listed. If you clicked Add Repo on your Dashboard, a specific repository that you want to add may not be listed. Not to worry though -- in this situation you can still add the repository to Code Climate by following the steps below.
From your Dashboard, within the organization in which you want to add the repository, navigate to the URI text box.
In most instances, you can get to this text box by clicking Add Repo, then clicking Manually add a Git repo by URL. That said, in other cases the click-by-click process may differ. While navigating, you may be prompted to enter an organization name.
- Enter the repository's URI.
By default we'll use port 9418 to connect to your repository. If you use a non-standard port, specify this via your URI by using the following pattern:
ssh://git@<Fully Qualified Domain Name>:<Git Port>/<Repo Path>/<Repo Name>.git.
- Install the public SSH key on your Git server. By doing so, you'll be granting Code Climate access to git clone and git pull from your repository. The installation process differs based on where your repository is hosted:
- For DIY Git servers: Install the key into your "authorized keys" file (e.g., ~/.ssh/authorized_keys). Code Climate requires an open line of communication with the server hosting your repository.
- For hosted Git services (e.g., GitHub, Bitbucket, GitLab): The installation process usually involves copying/pasting the full public key into a text box within your repository's "settings" menu. The following are links to various SSH key installation help files: GitHub, Bitbucket, and GitLab. When reading these articles, skip any steps involving key generation (since your key is already generated). Also, note that for many Git services, you'll specifically be dealing with deploy keys, which are SSH keys attached directly to the repository instead of a personal user account.
- Back in Code Climate, click This Deploy Key Is In Place.
- Code Climate will begin analyzing your repository right away. You'll see a "processing" indicator until our analysis is finished (which is usually within 5-15 minutes). Your Feed page will be empty until there's a new commit for us to review and until we find something worth telling you about.
- To complete your repository setup, you'll want to install our webhook. This hook is what notifies us of certain events happening in your repository, including commits made to your default branch. When we receive the notification, we'll run a new analysis on the spot. Please see our instructions to get it installed for repos hosted on Bitbucket, Beanstalk and GitLab.
If our webhook is not installed, we won't receive instant notifications of commits made to your repository, and instead we'll check for new commits on a poll.