DataGrip 2024.1 Help

Start a GitHub project in DataGrip

This tutorial covers two general use cases:

Cloning an existing GitHub repository

Step 1. Log in to your GitHub account

This step is optional. If the repository is private, log in to the GitHub account.

  1. In settings Ctrl+Alt+S, navigate to Version Control | GitHub.

  2. Click Add account Alt+Insert.

  3. In the Add GitHub Account, enter your credentials.

  4. Click Add Account.

Log in to your GitHub account

Step 2. Clone a GitHub repository

For example purposes, we are going to use the dumps repository: https://github.com/DataGrip/dumps.

  1. Navigate to Git | Clone.

  2. In the URL field, paste https://github.com/DataGrip/dumps.git.

  3. In the Directory field, specify a storage path for dumps files .

  4. Click Clone.

  5. In the Trust an Open Project '<project_name>'? project security dialog, click Don't Open. If you click Trust Project or Preview in Safe Mode, DataGrip suggests creating a new project with cloned files.

Clone a GitHub repository

Step 3. Attach the directory

Attach the directory mapped to the GitHub repository to your project.

  1. Open the Files tool window by doing one of the following:

    • In the main menu, go to View | Tool Windows | Files in the menu.

    • Click Files tool window icon Files on the main toolbar.

    • Press Alt+2.

  2. In the Files tool window , click the Attach Directory to Project button (Attach Directory to Project) in the toolbar.

    Alternatively, right-click in the area of the Files tool window and select Attach Directory to Project.

  3. In the file browser, navigate to the directory that you want to attach (for example, dumps).

  4. Click Open.

Attach a directory

Step 4. Register the VCS root directory

DataGrip supports a directory-based versioning model. It means that each project directory can be associated with a different version control system.

  1. In the Settings dialog (Ctrl+Alt+S) , open version control settings (Version Control | Directory Mappings). This page shows a list of project directories and version control systems associated with them (if no directories have been added, the list only contains the project root).

  2. Click the Add button (the Add button).

  3. In the Add VCS Directory Mapping dialog, select the Directory option. Type the path to the directory that you want to associate with a version control system, or click the Browse button (the Browse button) and select the dumps directory.

  4. From the VCS list, select Git.

  5. Click OK.

Sharing a directory on GitHub

Step 1. Log in to your GitHub account

  1. In settings Ctrl+Alt+S, navigate to Version Control | GitHub.

  2. Click Add account Alt+Insert.

  3. In the Add GitHub Account, enter your credentials.

  4. Click Add Account.

Log in to your GitHub account

Step 2. Attach a directory

To share your scripts on GitHub, you need to attach the directory from your computer to the Files tool window.

  1. Open the Files tool window by doing one of the following:

    • In the main menu, go to View | Tool Windows | Files in the menu.

    • Click Files tool window icon Files on the main toolbar.

    • Press Alt+2.

  2. In the Files tool window , click the Attach Directory to Project button (Attach Directory to Project) in the toolbar.

    Alternatively, right-click in the area of the Files tool window and select Attach Directory to Project.

  3. In the file browser, navigate to the directory that you want to attach (for example, MyScripts).

  4. Click Open.

Attach a directory

Step 3. Create a local Git repository

In the attached directory, create a Git repository that you will link with the remote repository on GitHub.

  1. Navigate to Git | Create Git Repository.

  2. In the file browser, navigate to the directory that you want to share.

  3. Click Open.

Create a local repository

Step 4. Create a GitHub repository

  1. On GitHub, click the plus icon and select New repository.

  2. In the Repository name field, specify a name for your repository (for example, dumps).

  3. (Optional) Specify other repository settings.

  4. Click Create repository.

    As a result, the GitHub repository is created. On the Code tab, you will see a link to your repository (for example, https://github.com/JetBrainsUser/MyScripts.git).

  1. In DataGrip, navigate to Git | Manage Remotes.

  2. In the Git Remotes dialog, click the Add icon (the Add icon).

  3. In the Define Remote dialog, paste the link to your GitHub repository.

  4. Apply changes by clicking OK.

Link local and remote repositories

Step 6. Commit local changes

  1. In the Files tool window (View | Tool Windows | Files), right-click the dumps folder and select Git | Commit Directory.

  2. In the Commit tool window that opens, select the Unversioned Files checkbox in the files pane.

  3. In the text field, write a commit message.

  4. Click Commit.

Commit local changes

Step 7. Push local changes

  1. In the main menu, navigate to Git | Push.

  2. In the Push Commits dialog, click Push.

Push local changes
Last modified: 26 May 2024