JetBrains Space Help

Mirror a GitHub Repository

Create a synchronized copy of an external repository hosted on GitHub. For GitHub repositories, Space supports pull requests/merge requests synchronization.

  1. Navigate to the project in which you want to create a repository.

  2. On the project sidebar, choose Repositories.

  3. On the repositories page, click New repository:

    clickNewRepository.png
  4. On the dialog window, choose Import a repository:

    createRepoForm-GitHubMirror.png
  5. Specify the following:

    • GitHub repository URL

      Provide the URL of your source repository hosted on GitHub in the following format:

      https://github.com/owner-name/repository-name.

    • Repository name

      Give your Space mirror repository a distinctive name and optional description. The name may not necessarily match your remote GitHub repository name.

    • Select Mirror changes from external repository.

    • Authentication

      If you have administrator rights for the GitHub repository, we strongly recommend you to authenticate with a personal access token by choosing Token from the menu. In this case, Space will automatically create a webhook on the GitHub side, that will ensure instant two-way synchronization of updates, including pull/merge requests.

      You can use your existing GitHub token or create a new one — just click the Get a new token button. Then paste your token into the specified field.

      If connecting via SSH, you need to have an SSH key pair (private and public) generated and stored on your local machine in the .ssh\ subdirectory. Provide the private key to Space by uploading it to the corresponding field and enter the passphrase if your key is protected with one.

      You can choose Anonymous only if no credentials are required to access your GitHub repository.

    • Synchronization settings

      Choose updating options for your mirror:

      • Sync periodically — your mirror will be synced with the remote repository and updated approximately once an hour. Actual update frequency may vary as it depends on server load.

      • Sync on git fetch — the mirror will be synced with the remote repository every time someone runs the git fetch command.

      • Mirror Pull Requests to Merge Requests — GitHub pull requests will be reflected as merge requests in Space.

      All options can be selected.

    • Tracked branches and tags (Git refspecs) lets you mirror specific branches of the source GitHub repo, while leaving all other branches ignored.

      You can do that to fork your GitHub repository. For example, you mirror your GitHub repository's main and create local branches off of it in Space:

      +refs/heads/main:refs/heads/main

      Then you can push to your branches and keep them updated by rebasing them onto main, all without affecting the source GitHub repository.

      To mirror and sync all branches, leave this field blank!

  6. Check that all the information you entered is correct and test the connection to your GitHub repository by clicking the Test connection button.

    • If the connection is unsuccessful, make sure that the GitHub repository URL you entered is correct and you have sufficient rights to access the repository.

    • If the connection is successful, click Create.

    A synchronized copy of your external GitHub repository will be created and added to your project.

Last modified: 27 November 2023