---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/operations/migration.md
  - https://vibe.sourcecraft.dev/portal/docs/ru/sourcecraft/operations/migration.md
  - href: https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/operations/migration.md
    type: text/markdown
    title: Markdown version
  - href: https://vibe.sourcecraft.dev/portal/docs/en/llms.txt
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://vibe.sourcecraft.dev/portal/docs/en/llms.txt

# Importing, mirroring, or synchronizing a repository in SourceCraft

<!-- source: en/_includes/sourcecraft/migration-intro.md -->
You can _import_ or _mirror_ into SourceCraft your source code repository hosted in another IT project management system for [Git](https://git-scm.com/).

Mirroring allows you to automatically synchronize particular branches between the source repository and the SourceCraft repository. Automatic synchronization is done once every **two hours**. You can find the time of the last and upcoming synchronization on the repository overview page. You can also [run](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/operations/migration.md#sync-manually) synchronization manually.

{% note warning %}

The number of mirrored repositories is [subject to limits](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/pricing.md#tariff-differences) and depends on the service plan you choose. There are also [limits](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/concepts/limits.md) on the number of synchronizations over 24 hours.

{% endnote %}

Simple code import (commit history, all existing branches and tags) is supported for any public repositories from any Git hosting services.

When migrating a repository from [GitHub](https://github.com), you can optionally import the following:
* Pull requests
* Issues
* Comments

<!-- source: en/_includes/sourcecraft/mirroring-gh-resources-note.md -->
{% note warning %}

Pull requests, issues and comments are transferred only during the initial synchronization and do not get updated afterwards. Mirroring is limited to particular branches of the source repository.

{% endnote %}
<!-- endsource: en/_includes/sourcecraft/mirroring-gh-resources-note.md -->
<!-- endsource: en/_includes/sourcecraft/migration-intro.md -->

## Importing or mirroring a repository {#import-mirror}

1. Open the SourceCraft [home page](https://sourcecraft.dev).
1. In the left-hand panel, click ![image](../../_assets/console-icons/plus.svg) **Create repository**.
1. In the window that opens, go to the ![image](../../_assets/console-icons/folder-arrow-up.svg) **Migrate existing** tab.
1. Under **Your source repository details**, select the repository source:

    {% list tabs group=source %}

    - GitHub {#github}

      1. Click ![image](../../_assets/overview/solution-library-icon.svg) **GitHub**.
      1. Create a [GitHub personal access token](https://github.com/settings/tokens/new) (PAT) with the following permissions:

          * `repo`: To display the list of your public and private repositories available for import.
          * `read:org`: To import collaborators from GitHub repositories or if the project contains Git LFS files (optional).

          For more information, see [this GitHub guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).

          {% note info %}

          To migrate entities from the source repository, in addition to code, a token must be issued by the repository administrator.

          {% endnote %}

      1. Paste the new token into the **GitHub personal access token** field and click **Authenticate**.
      1. In the **Owner** field, select the owner of the source repository.
      1. In the **Repository** field, select the repository you want to import.

    - Repository by URL {#url}

      1. Click ![image](../../_assets/console-icons/link.svg) **Repository by URL**.
      1. In the **Repository URL** field, specify the link to the repository hosted in another IT project management system.
      1. Specify **Personal access token**.

    {% endlist %}

1. Under **Your new repository details**:
    * In the **Owner** field, select the owner of the new repository: your account or organization.
    * In the **Name** field, specify a name for the repository you want to create in SourceCraft. The name may contain the following [ASCII characters](https://ru.wikipedia.org/wiki/ASCII): lowercase and uppercase Latin letters, numbers, commas, hyphens, and underscores.

1. Optionally, under **What to migrate**, select the entities to migrate from the source repository:

    {% list tabs group=source %}

    - GitHub {#github}

      * **Code**: Source code, branches, commits, and full repository history. This entity is always migrated and cannot be disabled.
      * **Pull requests**: Pull requests, reviews, and associated metadata and labels. To migrate only pull requests with the `open` status, enable the **Open pull requests only** option.
      * **Issues**: Issues and associated metadata and labels. To migrate only issues with the `open` status, enable the **Open issues only** option.
      * **Comments**: Comments on pull requests and issues.

      The estimated migration time is displayed to the right of the entity list. To speed up the migration, disable entities that do not need to be migrated.

    - Repository by URL

      Only source code, branches, commits, and full history can be migrated for repositories not hosted on GitHub. This entity is always migrated and cannot be disabled.

    {% endlist %}

1. Under **Visibility**, select the access type for the new repository:
    * **Public**: Can be viewed by any user. You can choose who can edit the repository.
    * **Internal**: Can be accessed only by users of the owner organization.
    * **Private**: You will choose who can view and edit the repository.

1. Optionally, if you want to mirror the repository, enable **Activate synchronization** under **Synchronization** and specify the branches you want automatically updated from the source repository in the **Branches to sync** field. You can use templates, for example, `main`, `feature/*`, or `release/*`.

    <!-- source: en/_includes/sourcecraft/mirroring-gh-resources-note.md -->
    {% note warning %}

    Pull requests, issues and comments are transferred only during the initial synchronization and do not get updated afterwards. Mirroring is limited to particular branches of the source repository.

    {% endnote %}
    <!-- endsource: en/_includes/sourcecraft/mirroring-gh-resources-note.md -->

    <!-- source: en/_includes/sourcecraft/mirroring-restrictions.md -->
    The mirrored SourceCraft repository branches are subject to [branch policy](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/concepts/branch-policies.md) protection rules. You cannot change them in SourceCraft; they get updated only when syncing with the source repository. 

    If the branch policy is disabled or overridden by a user with the `Repository admin` [role](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/security/index.md#src-repositories-admin), the SourceCraft commit history will be overwritten (`force push`) during the next repository sync.
    <!-- endsource: en/_includes/sourcecraft/mirroring-restrictions.md -->

1. SourceCraft will automatically check access to the source repository and whether or not SourceCraft can create a repository with the name you specified.

    If all checks are successful, you will see this message: ![image](../../_assets/console-icons/circle-check.svg) **Everything's ready to migrate. Fasten your seat belts and let's take off!**.

    Click **Begin migration**.

This will open the window with a list of your repositories in SourceCraft. Next to the repository you are importing, you will see the migration status. Click the status to view the details.

Once the migration is complete, you will be able to work with the migrated repository in SourceCraft.

## Synchronizing a repository manually {#sync-manually}

Automatic synchronization is done once every **two hours**. You can find the time of the last and upcoming synchronization on the repository overview page.

To synchronize a mirrored repository manually:
1. Open the SourceCraft [home page](https://sourcecraft.dev).
1. On the ![image](../../_assets/console-icons/house.svg) **Home** tab, under ![image](../../_assets/console-icons/layout-tabs.svg) **Your craftspace**, navigate to ![image](../../_assets/console-icons/archive.svg) **Repositories**.
1. Select the mirrored repository.
1. Click **Sync now** in the ![image](../../_assets/console-icons/thunderbolt.svg) synchronization info section on the repository overview page.

    {% note info %}

    There are [limits](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/concepts/limits.md) on the number of synchronizations per 24 hours.

    {% endnote %}

#### Useful links {#see-also}

* [Getting started with SourceCraft](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/quickstart.md)
* [SourceCraft resource relationships](https://vibe.sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md)
