In dbt Cloud, you can import a git repository from any valid git URL that points to a dbt project. There are some important considerations to keep in mind when doing this.
You must use the git@... or 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.
After importing a project by Git URL, dbt Cloud will generate a Deploy Key for your repository. To find the deploy key in dbt Cloud:
Click the gear icon in the upper right-hand corner.
Click Account Settings --> Projects and select a project.
Click the Repository link to the repository details page.
Copy the key under the Deploy Key section.
You must provide this Deploy Key in the Repository configuration of your Git host. Configure this Deploy Key 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. You will need to supply both deploy keys to your Git provider.
Use a deploy key to import your BitBucket repository into dbt Cloud. To preserve account security, use a service account to add the BitBucket deploy key and maintain the connection between your BitBucket repository and dbt Cloud.
BitBucket links every repository commit and other Git actions (such as opening a pull request) to the email associated with the user's Bitbucket account.
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.
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 Clone 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.
Note: The dbt Cloud-generated public key is the only key that will work in the next step. Any other key that has been generated outside of dbt Cloud will not work.
CodeCommit uses master as its default branch, and to initialize your project, you'll need to specify the master branch as a custom branch in dbt Cloud.
Go to Deploy -> Environments -> Development.
Select Settings -> Edit and under General Settings, check the Default to a custom branch checkbox.
Specify the custom branch as master and click Save.
To prevent users from directly merging code changes into the default branch, configure the PR Template URL in the Repository details page for your project. Once configured, dbt Cloud will prompt users to open a new PR after committing and synching code changes on the branch in the IDE, before merging any changes into the default branch.
Go to Account Settings -> Projects -> Select the project.
Click the repository link under Repository.
In the Repository details page, click Edit in the lower right.
Configure PR template in the 'Repository details' page.
In the Pull request URL field, set the URL based on the suggested PR template format.
Replace <repo> with the name of your repository (Note that it is case sensitive). In the following example, the repository name is New_Repo.
In the Pull request URL field example, the repository name is 'New_Repo'.
After filling the Pull request URL field, click Save.
🎉 You're all set! Once dbt Support handles your request and you've set your custom branch, your project is ready to execute dbt runs on 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.
Navigate to the 'SSH public keys' settings page
Next, click the + New Key button to create a new SSH key for the repository.
Click the '+ New Key' button to create a new SSH key for the repository.
Select 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.
Enter and save the public key generated for your repository by dbt Cloud
Some features of dbt Cloud require a tight integration with your git host, for example, 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.
A .gitignore file specifies which files git should intentionally ignore or 'untrack'. dbt Cloud indicates untracked files in the project file explorer pane by putting the file or folder name in italics.
If you encounter issues like problems reverting changes, checking out or creating a new branch, or not being prompted to open a pull request after a commit in the dbt Cloud IDE — this usually indicates a problem with the .gitignore file. The file may be missing or lacks the required entries for dbt Cloud to work correctly.
To resolve issues with your gitignore file, adding the correct entries won't automatically remove (or 'untrack') files or folders that have already been tracked by git. The updated gitignore will only prevent new files or folders from being tracked. So you'll need to first fix the gitignore file, then perform some additional git operations to untrack any incorrect files or folders.
Launch the Cloud IDE into the project that is being fixed, by selecting Develop on the menu bar.
In your File Explorer, check to see if a .gitignore file exists at the root of your dbt project folder. If it doesn't exist, create a new file.
Open the new or existing gitignore file, and add the following:
# ✅ Correct target/ dbt_packages/ logs/ # legacy -- renamed to dbt_packages in dbt v1 dbt_modules/
Note — You can place these lines anywhere in the file, as long as they're on separate lines. The lines shown are wildcards that will include all nested files and folders. Avoid adding a trailing '*' to the lines, such as target/*.
For more info on gitignore syntax, refer to the Git docs.
Save the changes but don't commit.
Restart the IDE by clicking on the three dots next to the IDE Status button on the lower right corner of the IDE screen and select Restart IDE.
Restart the IDE by clicking the three dots on the lower right or click on the Status bar
Once the IDE restarts, go to the File Explorer to delete the following files or folders (if they exist). No data will be lost:
target, dbt_modules, dbt_packages, logs
Save and then Commit and sync the changes.
Restart the IDE again using the same procedure as step 5.
Once the IDE restarts, use the Create a pull request (PR) button under the Version Control menu to start the process of integrating the changes.
When the git provider's website opens to a page with the new PR, follow the necessary steps to complete and merge the PR into the main branch of that repository.
Note — The 'main' branch might also be called 'master', 'dev', 'qa', 'prod', or something else depending on the organizational naming conventions. The goal is to merge these changes into the root branch that all other development branches are created from.
Return to the dbt Cloud IDE and use the Change Branch button, to switch to the main branch of the project.
Once the branch has changed, click the Pull from remote button to pull in all the changes.
Verify the changes by making sure the files/folders in the .gitignore file are in italics.
A dbt project on the main branch that has properly configured gitignore folders (highlighted in italics).
Sometimes it's necessary to use the git providers web interface to fix a broken .gitignore file. Although the specific steps may vary across providers, the general process remains the same.
There are two options for this approach: editing the main branch directly if allowed, or creating a pull request to implement the changes if required:
Edit in main branch
Unable to edit main branch
When permissions allow it, it's possible to edit the .gitignore directly on the main branch of your repo. Here are the following steps:
Go to your repository's web interface.
Switch to the main branch and the root directory of your dbt project.
Find the .gitignore file. Create a blank one if it doesn't exist.
Edit the file in the web interface, adding the following entries:
target/ dbt_packages/ logs/ # legacy -- renamed to dbt_packages in dbt v1 dbt_modules/
Commit (save) the file.
Delete the following folders from the dbt project root, if they exist. No data or code will be lost:
target, dbt_modules, dbt_packages, logs
Commit (save) the deletions to the main branch.
Switch to the dbt Cloud IDE, and open the project that you're fixing.
Rollback your repo to remote in the IDE by clicking on the three dots next to the IDE Status button on the lower right corner of the IDE screen, then select Rollback to remote.
Note — Rollback to remote resets your repo back to an earlier clone from your remote. Any saved but uncommitted changes will be lost, so make sure you copy any modified code that you want to keep in a temporary location outside of dbt Cloud.
Once you rollback to remote, open the .gitignore file in the branch you're working in. If the new changes aren't included, you'll need to merge the latest commits from the main branch into your working branch.
Go to the File Explorer to verify the .gitignore file contains the correct entries and make sure the untracked files/folders in the .gitignore file are in italics.
Great job 🎉! You've configured the .gitignore correctly and can continue with your development!
If you can't edit the .gitignore directly on the main branch of your repo, follow these steps:
Go to your repository's web interface.
Switch to an existing development branch, or create a new branch just for these changes (This is often faster and cleaner).
Find the .gitignore file. Create a blank one if it doesn't exist.
Edit the file in the web interface, adding the following entries:
target/ dbt_packages/ logs/ # legacy -- renamed to dbt_packages in dbt v1 dbt_modules/
Commit (save) the file.
Delete the following folders from the dbt project root, if they exist. No data or code will be lost:
target, dbt_modules, dbt_packages, logs
Commit (save) the deleted folders.
Open a merge request using the git provider web interface. The merge request should attempt to merge the changes into the 'main' branch that all development branches are created from.
Follow the necessary procedures to get the branch approved and merged into the 'main' branch. You can delete the branch after the merge is complete.
Once the merge is complete, go back to the dbt Cloud IDE, and open the project that you're fixing.
Rollback your repo to remote in the IDE by clicking on the three dots next to the IDE Status button on the lower right corner of the IDE screen, then select Rollback to remote.
Note — Rollback to remote resets your repo back to an earlier clone from your remote. Any saved but uncommitted changes will be lost, so make sure you copy any modified code that you want to keep in a temporary location outside of dbt Cloud.
Once you rollback to remote, open the .gitignore file in the branch you're working in. If the new changes aren't included, you'll need to merge the latest commits from the main branch into your working branch.
Go to the File Explorer to verify the .gitignore file contains the correct entries and make sure the untracked files/folders in the .gitignore file are in italics.
Great job 🎉! You've configured the .gitignore correctly and can continue with your development!
For more info, refer to this detailed video for additional guidance.
How to migrate git providers
To migrate from one git provider to another, refer to the following steps to avoid minimal disruption:
Outside of dbt Cloud, you'll need to import your existing repository into your new provider.
As an example, if you're migrating from GitHub to Azure DevOps, you'll need to import your existing repository (GitHub) into your new git provider (Azure DevOps). For detailed steps on how to do this, refer to your git provider's documentation (Such as GitHub, GitLab, Azure DevOps)
Disconnect the old repository in dbt Cloud by going to Account Settings and then Projects. Click on the Repository link, then click Edit and Disconnect.
Disconnect and reconnect your git repository in your dbt Cloud Account Settings pages.
On the same page, connect to the new git provider repository by clicking Configure Repository
If you're using the native integration, you may need to OAuth to it.
That's it, you should now be connected to the new git provider! 🎉
Note — As a tip, we recommend you refresh your page and dbt Cloud IDE before performing any actions.