Link a database to a Git repository in Bitbucket

Bitbucket is a Git-based version control system that helps teams collaborate on software development. It supports Git repositories, branching, pull requests, issue tracking, and integration with tools like Jira and Confluence.

Prerequisites

  • Install Git for Windows on the machine where you plan to use version control.
  • Create a repository on Bitbucket. You can follow the instructions in Create a repository on Bitbucket.
  • Clone a repository. You can follow the instructions in Clone a repository using the command line.

Create a repository on Bitbucket

1. Sign in to your Bitbucket account.

2. At the top of the page, select Create > Repository.

Alternatively, in the Recent repositories or Welcome sections, select Create repository.

Create a new repository on Bitbucket

3. On the Create a new repository page, configure the following options:

  • Project – Choose an existing project or enter a name to create a new one.
  • Repository name – Enter a name for the repository.
  • Access level – By default, the repository is set to Private. To make it public, clear the checkbox.
  • Include a README? – Select:
    • Yes, with a tutorial (for beginners) or Yes, with template to add a README file.
    • No to exclude it.
  • Default branch name – Enter the default branch name (for example, main).
  • Include .gitignore? – Select:
    • Yes, recommended to include a .gitignore file.
    • No to skip it.

4. Click Create repository.

Configure the repository settings

Clone a repository using the command line

1. Create an empty folder on the disk of your computer to store the local repository.

For example, D:\bitbucket.

2. Sign in to your Bitbucket account.

3. On the top menu, select Repositories, then select the repository you want to clone.

4. In the upper-right corner, click Clone.

Clone a repository on Bitbucket

5. In the Clone this repository dialog, choose a connection protocol:

  • HTTPS (default) – Uses a user/password authentication.
  • SSH – Uses a public/private key pair.

6. Copy the clone command.

Note

To clone a Bitbucket repository using SSH, add your public key to your Bitbucket account and save the key on your local machine. This setup enables secure authentication between your computer and the Bitbucket server.

7. Open Command Prompt (CMD).

8. Navigate to the empty folder you created.

Tip

Use the cd command to navigate to a specific folder in the command prompt.

9. Clone the repository by running:

git clone <repository-url> .

Tip

Include a period (.) at the end of the command to clone the repository into the current folder.

When the HTTPS protocol is selected, you will be prompted to enter the username and password to your Bitbucket account.

10. If the repository is empty, run:

git commit --allow-empty -m initial
git push`

Clone a repository from the command line

Link the database to source control in dbForge Studio

After cloning the repository, you can link your database to the local repository folder.

To link a database to the source control:

1. In Database Explorer, right-click the database you want to link and select Source Control > Link Database to Source Control.

Alternatively, on the top menu, select Database > Link Database to Source Control.

2. In the Link Database to Source Control dialog, click + in the Source control repository field.

3. In the Source Control Repository Properties dialog, enter the required repository settings:

  • Set Source control system to Git.
  • In the Repository folder field, enter the full path to the local clone of your Bitbucket repository, or click the ellipsis (…) and browse for the folder.

Warning

The Repository folder must point to a local folder. Do not enter a remote URL.

  • By default, the selected folder name is used as the repository name. To specify a different name, enter it manually.

  • Optional: To verify the repository settings, click Test.
  • To save the settings and close the dialog, click OK.

Select the repository folder

4. Choose a database development model:

  • Shared – Developers collaborate on a single shared database.
  • Dedicated – Each developer works on a local copy of the database.

5. To connect the database to the repository, click Link.

Link a database to source control

The Refresh window opens and displays the progress of the refresh operation.

After the database is linked, it appears in Database Explorer with the source control icon:

Linked database in Database Explorer

Set up version control after linking

After linking the database, your next step depends on whether the repository is new or already in use by your team:

  • If this is the first time the database is linked:

In the Local changes section of the Source Control Manager, select the objects you want to add to version control, then click Commit.

For instructions, see Commit changes.

  • If the database is already under source control:

In the Remote changes section, select the objects you want to retrieve, then click Get Latest.

Note

The Get Latest option is available only in the dedicated development model.

For instructions, see Get the latest version.