Help Center/ CodeArts Repo/ User Guide/ Cloning or Downloading Code Repo to a Local PC/ Using the SSH Key to Clone a Repo to a Local PC
Updated on 2024-11-22 GMT+08:00

Using the SSH Key to Clone a Repo to a Local PC

Using Git Bash to Clone a Repo to a Local Host

The SSH key is a secure identity authentication method used to access a remote server. Using an SSH key to clone a code repository avoids the username and password each time for higher efficiency of cloning a code repository.

  1. Access CodeArts Repo homepage.
  2. Go to the repo homepage of the code to be cloned, create a personal branch, click Clone/Download, and copy the SSH address.
  3. On the local Git Bash client, run the following command to access the address of the code repository to be cloned. This command indicates that the cloned code repository will be cloned to the Repo folder in drive D. You can change the address as needed.

    cd D:/Repo

  4. Run the following command to clone the repository to the directory:

    SSH address of git clone code repo

    If you clone the repository for the first time, the system asks you whether to trust the remote repository. Enter yes.

    If the following figure is displayed, the repo is cloned successfully.

    Figure 1 Successful cloning of the repository using the SSH key

    If Git Bash reports error git@test.com: Permission denied.fatal: Could not read from remote repository.Please make sure you have the correct access rights and the repository exists. in step 3, the SSH key for accessing Repo has not been configured. Configure the SSH key first. For details, see Configuring an SSH Private Key.

Use the SSH key to clone the code repo to the local host in TortoiseGit.

  1. Access CodeArts Repo homepage.
  2. Go to the home page of the code repo to be cloned, click Clone/Download, and copy the SSH address.
  3. Go to the local directory where you want to clone the repository, and choose Git Clone... from the right-click menu.
  4. In the displayed dialog box, paste the SSH address copied in step 2 to the URL text box, select Load PuTTY key, and select the private key file generated during TortoiseGit installation.
  5. Click OK. If you clone the code repository on the TortoiseGit client for the first time, the system asks you whether to trust the remote repository. Click Yes.