Start a GitHub project in DataGrip
This tutorial covers two general use cases:
This step is optional. If the repository is private, log in to the GitHub account.
note
This functionality relies on the GitHub plugin, which you need to install and enable. For more information, refer to Install a plugin from Marketplace.
In settings CtrlAlt0S, navigate to Version Control | GitHub.
Click Add account AltInsert.
In the Add GitHub Account, enter your credentials.
Click Add Account.
For example purposes, we are going to use the dumps repository: https://github.com/DataGrip/dumps.
Navigate to Git | Clone.
In the URL field, paste
https://github.com/DataGrip/dumps.git
.In the Directory field, specify a storage path for dumps files .
Click Clone.
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.
Attach the directory mapped to the GitHub repository to your project.
You can open the Files tool window by doing one of the following:
In the main menu, go to View | Tool Windows | Files.
On the right tool window bar, click Files.
Press Alt02.
In the Files tool window , click the Attach Directory to Project button () in the toolbar.
Alternatively, right-click in the area of the Files tool window and select Attach Directory to Project.
In the file browser, navigate to the directory that you want to attach (for example, dumps).
Click Open.
DataGrip supports a directory-based versioning model. It means that each project directory can be associated with a different version control system.
In the Settings dialog (CtrlAlt0S) , 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).
Click the Add button ().
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 () and select the dumps directory.
From the VCS list, select Git.
Click OK.
note
This functionality relies on the GitHub plugin, which you need to install and enable. For more information, refer to Install a plugin from Marketplace.
In settings CtrlAlt0S, navigate to Version Control | GitHub.
Click Add account AltInsert.
In the Add GitHub Account, enter your credentials.
Click Add Account.
To share your scripts on GitHub, you need to attach the directory from your computer to the Files tool window.
You can open the Files tool window by doing one of the following:
In the main menu, go to View | Tool Windows | Files.
On the right tool window bar, click Files.
Press Alt02.
In the Files tool window , click the Attach Directory to Project button () in the toolbar.
Alternatively, right-click in the area of the Files tool window and select Attach Directory to Project.
In the file browser, navigate to the directory that you want to attach (for example, MyScripts).
Click Open.
In the attached directory, create a Git repository that you will link with the remote repository on GitHub.
Navigate to Git | Create Git Repository.
In the file browser, navigate to the directory that you want to share.
Click Open.
On GitHub, click the plus icon and select New repository.
In the Repository name field, specify a name for your repository (for example, dumps).
(Optional) Specify other repository settings.
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
note
If you select the Initialize this repository with a README option, pull your repository before pushing commits.
In the main menu, navigate to Git | Manage Remotes.
In the Git Remotes dialog, click the Add icon ().
In the Define Remote dialog, paste the link to your GitHub repository.
Apply changes by clicking OK.
In the Files tool window (View | Tool Windows | Files), right-click the dumps folder and select Git | Commit Directory.
In the Commit tool window that opens, select the Unversioned Files checkbox in the files pane.
In the text field, write a commit message.
Click Commit.
In the main menu, navigate to Git | Push.
In the Push Commits dialog, click Push.
Thanks for your feedback!