Help Center/ CodeArts Repo/ User Guide/ Migrating Data to CodeArts Repo/ Importing a Remote Git Repository to CodeArts Repo
Updated on 2024-07-05 GMT+08:00

Importing a Remote Git Repository to CodeArts Repo

Background

CodeArts Repo allows you to import Git-based remote repositories.

Git-based remote repositories are cloud repositories hosted in storage services such as GitHub.

Method 1: Online Import

You can directly import your remote repository to CodeArts Repo online. The import speed will be affected by network conditions of the source repository.

  1. On the repository list page, click New Repository > Import. The Set Basic Information page is displayed.
  2. Enter information in the Source Repository URL field. If the source repository is open-source (public repository), select Username and password not required. If the source repository is private, select Username and password required.
  3. Click Next. On the Create Repository page, enter the basic information about the repository.
  4. Click OK to import the repository. The repository list page is displayed.

For details, see Importing an External Repository.

Method 2: Cloning the Git Repository to the Local Computer and Associating and Pushing It to CodeArts Repo

If you cannot import a repository online due to network issues, use this method. Using this method, you can clone a remote repository to the local computer, and then associate and push it to CodeArts Repo.

  1. Install and configure the Git client.
  2. Download a bare repository using the source repository address.

    The following uses GitHub as an example:

    1. Open a browser and enter the address of the GitHub code repository.
    2. Click Code on the right, click the HTTPS tab, and click on the right.

    3. Open the Git Bash client on the local PC, run the following command to clone the repository to the local PC, and run the cd command to go to the repository directory:
      git clone --bare <source_repository_address>

  3. Associate the local repository with CodeArts Repo and push it to CodeArts Repo.

    1. On the CodeArts Repo homepage, click New Repository. In the Permissions area, do not select Allow generation of a README file.
    2. Go to the repository details page created in 1, click Clone/Download, click the Clone with SSH or Clone with HTTPS tab as required, and click to obtain the repository address.

      In this example, the HTTPS address is used.

    3. In the root directory of local source code, open the Git Bash client and run the following command to push the local repository to the new repository:
      git push --mirror <new_repository_address>

      When the command is executed, the system prompts you to enter the HTTPS account and password of the CodeArts Repo repository. Enter the correct account and password. (For details, see how to obtain an HTTPS account and password.)

      If your source repository has branches and tags, they will also be pushed to CodeArts Repo.

After the push is successful, check whether the migration is complete in CodeArts Repo. (For details about how to view a CodeArts Repo repository, see Viewing the Repository List.)