In dbt Cloud, you can import a git repository from any valid git URL that points to a dbt project. There are a couple of important considerations to keep in mind when doing this:
You must use the
ssh:... version of your git URL, not the
https://... version. dbt Cloud uses the SSH protocol to clone repositories, so dbt Cloud will be unable to clone repos supplied with the HTTP protocol.
Managing Deploy Keys
After importing a project by Git URL, dbt Cloud will generate a Deploy Key for your repository. You must provide this Deploy Key in the Repository configuration of your Git host. This Deploy Key should be be configured to allow read and write access to the specified repositories.
Note: Each dbt Cloud project will generate a different deploy key when connected to a repo, even if two projects are connected to the same repo. Both deploy keys will need to be supplied to your git provider.
To add a deploy key to a GitHub account, navigate to the Deploy keys tab of the settings page in your GitHub repository. After supplying a name for the deploy key and pasting in your deploy key (generated by dbt Cloud), be sure to check the "Allow write access" checkbox. After adding this key, dbt Cloud will be able to read and write files in your dbt project.
See also: Adding a deploy key in GitHub
To add a deploy key to a GitLab account, navigate to the SSH keys tab in the User Settings page of your GitLab account. Next, paste in the deploy key generated by dbt Cloud for your repository. After saving this SSH key, dbt Cloud will be able to read and write files in your GitLab repository.
See also: Adding a read only deploy key in GitLab
To add a deploy key to a BitBucket account, navigate to "SSH keys" tab in the Personal Settings page of your BitBucket account. Next, click the "Add key" button and paste in the deploy key generated by dbt Cloud for your repository. After saving this SSH key, dbt Cloud will be able to read and write files in your BitBucket repository.
dbt Cloud can work with dbt projects hosted on AWS CodeCommit, but there are some extra steps needed compared to Github or other git providers. This guide will help you connect your CodeCommit-hosted dbt project to dbt Cloud.
Step 1: Create an AWS User for dbt Cloud
To give dbt Cloud access to your repository, first you'll need to create an AWS IAM user for dbt Cloud. Log into the AWS Console and navigate to the IAM section. Click "Add User", and create a new user with "Programmatic Access".
This user will need clone access to your repository. The easiest way to set that up is to add the "AWSCodeCommitPowerUser" permission during setup.
Step 2: Import your repository by name
Open the AWS CodeCommit console and choose your repository. Copy the SSH URL from that page. Next, navigate to the "New Repository" page in dbt Cloud. Choose the "Git URL" tab, and paste in the SSH URL you copied from the console.
In the newly created Repository details page, you'll see a "Deploy Key" field. Copy the contents of this field as you'll need it for step 3.
Step 3: Grant dbt Cloud AWS User access
Open up the newly created dbt Cloud user in the AWS IAM Console. Choose the "Security Credentials" tab and then click "Upload SSH public key". Paste in the contents of the "Public Key" field from the dbt Cloud Repository page.
Once you've created the key, you'll see an "SSH key ID" for it. You'll need to write into support and share that field so that dbt Cloud support can complete the setup process for you.
You're all set! Once support handles your request, your project is set up and you can begin executing dbt runs from dbt Cloud.
To add a deploy key to an Azure DevOps account, navigate to the "SSH public keys" page in the User Settings of your user's Azure DevOps account or a service user's account. We recommend using a dedicated service user for the integration to ensure that dbt Cloud's connection to Azure DevOps is not interrupted by changes to user permissions.
Next, click the "+ New Key" button to create a new SSH key for the repository.
Pick a descriptive name for the key and then paste in the deploy key generated by dbt Cloud for your repository. After saving this SSH key, dbt Cloud will be able to read and write files in your Azure DevOps repository.
Other git providers
Don't see your git provider here? Please contact support - we're happy to help you set up dbt Cloud with any supported git provider.
Some features of dbt Cloud require a tight integration with your git host, e.g. updating Github pull requests with dbt Cloud run statuses. Importing your project by a URL prevents you from using these features.
Once you give dbt Cloud access to your repository, you can continue to set up your project by adding a connection and creating and running your first dbt Cloud job.