# Add cloned repositories and share directories on GitHub

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/go/2026.3/llms.txt).

This tutorial covers two general use cases:

* [Cloning an existing GitHub repository](#add_a_cloned_github_repo_to_your_project)

* [Sharing a directory on GitHub](#share_a_directory_on_github)

## Add a cloned GitHub repository to your project

Procedure: Step 1. Log in to your GitHub account

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

> **Note:**
> This functionality relies on the   plugin, which   you need to install and enable.   For more information, refer to [Open plugin settings](managing-plugins.html#open-plugin-settings).

1. In settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Comma` (VSCode), `⌘ Comma` (VSCode (macOS)), navigate to `Version Control | GitHub`.

2. Click Add account `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (VSCode), `⌃ ⏎` (VSCode (macOS)).

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

4. Click Add Account.

![Log in to your GitHub account](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_log_in_to_account.png)

Procedure: Step 2. Clone a GitHub repository

For example purposes, we are going to use the dumps repository: [https://github.com/DataGrip/dumps](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](project-security.html), click Don't Open. If you click Trust Project or Preview in Safe Mode, GoLand suggests creating a new project with cloned files.

![Clone a GitHub repository](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_clone_repository.png)

Procedure: Step 3. Attach the directory

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

1. You can open the  Project tool window  by doing one of the following:

* In the main menu, go to `View | Tool Windows | Files`.

* Press `Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+Shift+E` (VSCode), `⌘ ⇧ E` (VSCode (macOS)).

2. In the  Project tool window , click the Attach Directory to Project… button (![Attach Directory to Project](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.open.svg)) 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](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_attach_directory.png)

Procedure: Step 4. Register the VCS root directory

GoLand 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` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Comma` (VSCode), `⌘ Comma` (VSCode (macOS))) , open [version control settings](settings-version-control.html) (`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](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)).

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](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.menu-open.svg)) and select the `dumps` directory.

4. From the VCS list, select Git.

5. Click OK.

## Share a directory on GitHub

Procedure: Step 1. Log in to your GitHub account

> **Note:**
> This functionality relies on the   plugin, which   you need to install and enable.   For more information, refer to [Open plugin settings](managing-plugins.html#open-plugin-settings).

1. In settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Comma` (VSCode), `⌘ Comma` (VSCode (macOS)), navigate to `Version Control | GitHub`.

2. Click Add account `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (VSCode), `⌃ ⏎` (VSCode (macOS)).

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

4. Click Add Account.

![Log in to your GitHub account](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_log_in_to_account.png)

Procedure: 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. You can open the  Project tool window  by doing one of the following:

* In the main menu, go to `View | Tool Windows | Files`.

* Press `Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+Shift+E` (VSCode), `⌘ ⇧ E` (VSCode (macOS)).

2. In the  Project tool window , click the Attach Directory to Project… button (![Attach Directory to Project](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.open.svg)) 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](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_attach_directory_sharing.png)

Procedure: 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](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_create_local_repo.png)

Procedure: 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`).

> **Note:**
> If you select the Initialize this repository with a README option, pull your repository before pushing commits.

Procedure: Step 5. Link local and remote repositories

1. In the main menu, navigate to  `Git | Manage Remotes` .

2. In the Git Remotes dialog, click the Add icon (![the Add icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.inlineAdd.svg)).

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

4. Apply changes by clicking OK.

![Link local and remote repositories](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_link_repositories.png)

Procedure: 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](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_commit_files.png)

Procedure: 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](https://resources.jetbrains.com/help/img/idea/2026.3/db_tutorial_github_push_files.png)

