---
title: "Connect with Git clone"
source: dbt Core Documentation
source_url: https://github.com/dbt-labs/docs.getdbt.com
licence: Apache-2.0
domain: data-and-analysis
subdomain: dbt-docs
date_added: 2026-04-25
---

In <Constant name="dbt" />, 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.

## Git protocols
You must use the `git@...` or `ssh://...` version of your git URL, not the `https://...` version. <Constant name="dbt" /> uses the SSH protocol to clone repositories, so <Constant name="dbt" /> will be unable to clone repos supplied with the HTTP protocol.

### Converting SSH URLs to the correct format

When you copy an SSH URL from your git provider (usually found under **Code** --> **Clone** --> **SSH**), it may be in an SCP-style format that uses a colon (`:`) to separate the host from the path. You'll need to convert this to a standard SSH URL format for <Constant name="dbt" />.

If your SSH URL looks like this (SCP-style with a colon):

```
git@github.com:organization/repo-name.git
user@custom-host.example.com:organization/repo-name.git
```

Convert it to the standard SSH URL (uses `ssh://` and `/`):
```
ssh://git@github.com/organization/repo-name.git
ssh://user@custom-host.example.com/organization/repo-name.git
```

import GitProvidersCI from '/snippets/_git-providers-supporting-ci.md';

<GitProvidersCI />

## Managing deploy keys

After importing a project by <Constant name="git" /> URL, <Constant name="dbt" /> will generate a Deploy Key for your repository. To find the deploy key in <Constant name="dbt" />:

1. From <Constant name="dbt" />, click on your account name in the left side menu and select **Account settings**.
2. Go to **Projects** and select a project.
3. Click the **Repository** link to the repository details page.
4. Copy the key under the **Deploy Key** section. 

You must provide this Deploy Key in the Repository configuration of your <Constant name="git" /> host. Configure this Deploy Key to allow *read and write access* to the specified repositories.

**Note**: Each <Constant name="dbt" /> 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 <Constant name="git" /> provider.

## GitHub

:::info Use GitHub?

If you use GitHub, you can import your repo directly using [<Constant name="dbt" />'s GitHub Application](/docs/cloud/git/connect-github). Connecting your repo via the GitHub Application [enables Continuous Integration](/docs/deploy/continuous-integration).

:::

### Locate your SSH URL

1. Navigate to your repository on GitHub.
2. Click the **Code** button.
3. Select the **SSH** tab to view the SSH clone URL.
4. Copy the URL and [convert it to the correct format](#converting-ssh-urls-to-the-correct-format) if needed.

### Add a deploy key

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 <Constant name="dbt" />), be sure to check the **Allow write access** checkbox. 
- After adding this key, <Constant name="dbt" /> will be able to read and write files in your dbt project.
- Refer to [Adding a deploy key in GitHub](https://github.blog/2015-06-16-read-only-deploy-keys/)

<Lightbox src="/img/docs/dbt-cloud/cloud-configuring-dbt-cloud/cd7351c-Screen_Shot_2019-10-16_at_1.09.41_PM.png" title="Configuring a GitHub Deploy Key"/>

## GitLab

:::info Use GitLab?

If you use GitLab, you can import your repo directly using [<Constant name="dbt" />'s GitLab Application](/docs/cloud/git/connect-gitlab). Connecting your repo via the GitLab Application [enables Continuous Integration](/docs/deploy/continuous-integration).

:::

- To add a deploy key to a GitLab account, navigate to the [SSH keys](https://gitlab.com/profile/keys) tab in the User Settings page of your GitLab account. 
- Next, paste in the deploy key generated by <Constant name="dbt" /> for your repository. 
- After saving this SSH key, <Constant name="dbt" /> will be able to read and write files in your GitLab repository.
- Refer to [Adding a read only deploy key in GitLab](https://docs.gitlab.com/ee/user/project/deploy_keys/)

<Lightbox src="/img/docs/dbt-cloud/cloud-configuring-dbt-cloud/f3ea88d-Screen_Shot_2019-10-16_at_4.45.50_PM.png" title="Configuring a GitLab SSH Key"/>

## BitBucket

Use a deploy key to import your BitBucket repository into <Constant name="dbt" />. To preserve account security, use a service account to add the BitBucket deploy key and maintain the connection between your BitBucket repository and <Constant name="dbt" />. 

BitBucket links every repository commit and other <Constant name="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 <Constant name="dbt" /> for your repository. 
- After saving this SSH key, <Constant name="dbt" /> will be able to read and write files in your BitBucket repository.

<Lightbox src="/img/docs/dbt-cloud/cloud-configuring-dbt-cloud/bitbucket-ssh-key.png" title="Configuring a BitBucket SSH Key"/>

## AWS CodeCommit

<Constant name="dbt" /> 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 <Constant name="dbt" />.

#### Step 1: Create an AWS User for dbt
- To give <Constant name="dbt" /> access to your repository, first you'll need to create an AWS IAM user for <Constant name="dbt" />. 
- Log into the AWS Console and navigate to the IAM section. 
- Click **Add User**, and create a new user by entering a unique and meaningful user name.
- The user will need clone access to your repository. You can do this by adding 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 <Constant name="dbt" />. 
- Choose the **<Constant name="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](#step-3-grant-dbt-cloud-aws-user-access).

**Note:** The <Constant name="dbt" />-generated public key is the only key that will work in the next step. Any other key that has been generated outside of <Constant name="dbt" /> will not work.

#### Step 3: Grant dbt AWS User access
- Open up the newly created <Constant name="dbt" /> 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 <Constant name="dbt" /> Repository page.
- Once you've created the key, you'll see an **SSH key ID** for it. 
- **[Contact dbt Support](mailto:support@getdbt.com)** and share that field so that dbt Support team can complete the setup process for you.

#### Step 4: Specify a custom branch in dbt

CodeCommit uses `master` as its default branch, and to initialize your project, you'll need to specify the `master` branch as a [custom branch](/faqs/Environments/custom-branch-settings#development) in <Constant name="dbt" />.

- 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**.

#### Step 5: Configure pull request template URLs (Optional)

To prevent users from directly merging code changes into the default branch, configure the [PR Template URL](/docs/cloud/git/pr-template) in the **Repository details** page for your project. Once configured, <Constant name="dbt" /> will prompt users to open a new PR after committing and synching code changes on the branch in the <Constant name="studio_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.
  <Lightbox src="/img/docs/collaborate/repo-details.jpg" width="80%" title="Configure PR template in the 'Repository details' page." />
- In the **Pull request URL** field, set the URL based on the suggested [PR template format](/docs/cloud/git/pr-template#aws-codecommit).
- Replace `<repo>` with the name of your repository (Note that it is case sensitive). In the following example, the repository name is `New_Repo`.
  <Lightbox src="/img/docs/collaborate/pr-template-example.jpg" width="60%" title="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 <Constant name="dbt" />.

## Azure DevOps
:::info Use Azure DevOps?

If you use Azure DevOps and you are on the <Constant name="dbt" /> Enterprise or Enterprise+ plan, you can import your repo directly using [<Constant name="dbt" />'s Azure DevOps Integration](/docs/cloud/git/connect-azure-devops). Connecting your repo via the Azure DevOps Application [enables Continuous Integration](/docs/deploy/continuous-integration).

:::

1. 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. 

2. We recommend using a dedicated service user for the integration to ensure that <Constant name="dbt" />'s connection to Azure DevOps is not interrupted by changes to user permissions.

<Lightbox src="/img/docs/dbt-cloud/cloud-configuring-dbt-cloud/52bfdaa-Screen_Shot_2020-03-09_at_4.13.20_PM.png" title="Navigate to the 'SSH public keys' settings page" />

3. Next, click the **+ New Key** button to create a new SSH key for the repository.

<Lightbox src="/img/docs/dbt-cloud/cloud-configuring-dbt-cloud/6d8e980-Screen_Shot_2020-03-09_at_4.13.27_PM.png" title="Click the '+ New Key' button to create a new SSH key for the repository." />

4. Select a descriptive name for the key and then paste in the deploy key generated by <Constant name="dbt" /> for your repository. 

5. After saving this SSH key, <Constant name="dbt" /> will be able to read and write files in your Azure DevOps repository.

<Lightbox src="/img/docs/dbt-cloud/cloud-configuring-dbt-cloud/d19f199-Screen_Shot_2020-03-09_at_4.13.50_PM.png" title="Enter and save the public key generated for your repository by dbt" />

## Other git providers

Don't see your git provider here? Please [contact dbt Support](mailto:support@getdbt.com) - we're happy to help you set up <Constant name="dbt" /> with any supported git provider.

## Limited integration
Some features of <Constant name="dbt" /> require a tight integration with your git host, for example, updating GitHub pull requests with <Constant name="dbt" /> run statuses. Importing your project by a URL prevents you from using these features. Once you give <Constant name="dbt" /> access to your repository, you can continue to set up your project by adding a connection and creating and running your first <Constant name="dbt" /> job.

## FAQs
<FAQ path="Git/gitignore"/>
<FAQ path="Git/git-migration"/>
