---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/migration.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/migration.md
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# Importing or mirroring 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.

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 -->

To import or mirror a repository in SourceCraft:
1. Open the SourceCraft [home page](https://sourcecraft.dev).
1. In the left-hand panel, click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M8 1.75a.75.75 0 0 1 .75.75v4.75h4.75a.75.75 0 0 1 0 1.5H8.75v4.75a.75.75 0 0 1-1.5 0V8.75H2.5a.75.75 0 0 1 0-1.5h4.75V2.5A.75.75 0 0 1 8 1.75" clip-rule="evenodd"/></svg> **Create repository**.
1. In the window that opens, go to the <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="m6.44 4.06.439.44H12.5A1.5 1.5 0 0 1 14 6v5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11V4.5A1.5 1.5 0 0 1 3.5 3h1.257a1.5 1.5 0 0 1 1.061.44zM.5 4.5a3 3 0 0 1 3-3h1.257a3 3 0 0 1 2.122.879L7.5 3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3zm4.97 3.47a.75.75 0 0 0 1.06 1.06l.72-.72v2.19a.75.75 0 0 0 1.5 0V8.31l.72.72a.75.75 0 1 0 1.06-1.06l-2-2a.75.75 0 0 0-1.06 0z" clip-rule="evenodd"/></svg> **Migrate existing** tab.
1. Under **Your source repository details**, select the repository source:

    {% list tabs group=source %}

    - GitHub {#github}

      1. Click <svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" fill="none" viewBox="0 0 34 34"><circle cx="17" cy="15" r="10" fill="#fff"/><path fill="#2D2C32" d="M17 6c-4.973 0-9 4.027-9 9 0 4.23 2.902 7.74 6.818 8.73a1.215 1.215 0 0 1-.068-.428v-1.53h-1.125c-.607 0-1.17-.27-1.418-.765-.292-.54-.337-1.373-1.08-1.89-.225-.18-.045-.36.203-.338.472.134.854.45 1.214.922.36.472.518.585 1.193.585.315 0 .81-.022 1.26-.09.247-.63.675-1.193 1.193-1.463-3.015-.36-4.455-1.845-4.455-3.87 0-.878.382-1.71 1.012-2.43-.202-.698-.472-2.138.09-2.7 1.351 0 2.16.877 2.363 1.102a6.929 6.929 0 0 1 2.182-.36 6.82 6.82 0 0 1 2.182.36c.203-.226 1.013-1.102 2.363-1.102.54.54.292 2.002.067 2.7.63.697.99 1.552.99 2.43 0 2.025-1.417 3.51-4.41 3.825.833.428 1.419 1.642 1.419 2.542v2.05c0 .067-.023.135-.023.202A8.965 8.965 0 0 0 26 15c0-4.973-4.027-9-9-9Z"/></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 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M3.47 6.53a.75.75 0 0 1 1.06 1.061l-.727.727a2.743 2.743 0 0 0 3.879 3.879l.727-.727a.75.75 0 0 1 1.06 1.06l-.726.727a4.243 4.243 0 0 1-6-6zm8 1.879a.75.75 0 0 0 1.06 1.06l.727-.726a4.243 4.243 0 0 0-6-6l-.727.727a.75.75 0 0 0 1.061 1.06l.727-.727a2.743 2.743 0 0 1 3.879 3.879zm-.94-1.879a.75.75 0 1 0-1.06-1.06l-4 4a.75.75 0 1 0 1.06 1.06z" clip-rule="evenodd"/></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://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://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: <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M13.5 8a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0m-3.9-1.55a.75.75 0 1 0-1.2-.9L7.419 8.858 6.03 7.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.13-.08z" clip-rule="evenodd"/></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.

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

[Getting started with SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/quickstart.md)
