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.
- On the CodeArts Repo homepage, click next to New Repository and select Import Repository from the drop-down list. The Import Repository page is displayed.
- 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.
- Click Next. On the Create Repository page, enter the basic information about the repository.
- 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.
- Install and configure the Git client.
- Download a bare repository using the source repository address.
The following uses GitHub as an example:
- Open a browser and enter the address of the GitHub code repository.
- Click Code on the right, click the HTTPS tab, and click on the right.
- 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>
- Associate the local repository with CodeArts Repo and push it to CodeArts Repo.
- On the CodeArts Repo homepage, click New Repository. In the Permissions area, do not select Allow generation of a README file.
- 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.
- 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 about how to obtain an HTTP account and password, see Changing the HTTPS 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.)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.