Updated on 2025-07-24 GMT+08:00

Configuring an SSH Key

Introduction

An SSH key securely connects a local computer with your CodeArts Repo. For details, see Procedure.

You can configure an SSH key by referring to Procedure or Configuring an SSH Key.

Constraints

If you have more than one computer, you need to configure an SSH key for each so that all accounts on the computer can be connected through the SSH key.

Procedure

You can configure an SSH key by referring to Configuring an SSH Key or the following steps.

  1. Run Git Bash to check whether an SSH key has been generated locally. Run the following command in Git Bash:

    cat ~/.ssh/id_rsa.pub
    • If No such file or directory is displayed, no SSH key has been generated on your computer. Go to 2.
    • If a character string starting with ssh-rsa is returned, an SSH key has been generated on your computer. If you want to use the generated key, go to 3. If you want to generate a new key, go to 2.

  2. Generate an SSH key. Run the following command to generate a key in Git Bash:

    ssh-keygen -t rsa -b 4096 -C your_email@example.com
    • -t rsa indicates that an RSA key is generated.
    • -b 4096 indicates the key length. (RSA keys of this length are more secure.)
    • -C your_email@example.com indicates that a comment is added to the generated public key file to help identify the purpose of the key pair.

    Enter the command for generating a key and press Enter. The key is stored in ~/.ssh/id_rsa by default, and the corresponding public key file is ~/.ssh/id_rsa.pub.

  3. Copy the SSH public key to the clipboard. Run the corresponding command based on your operating system.

    • Windows:
      clip < ~/.ssh/id_rsa.pub
    • Mac:
      pbcopy < ~/.ssh/id_rsa.pub
    • Linux (xclip required):
      xclip -sel clip < ~/.ssh/id_rsa.pub

  4. Log in to Repo and go to the code repository list page. Click the alias in the upper right corner and choose This Account Settings > Repo > SSH Keys. The SSH Keys page is displayed.

    You can also click Set SSH Keys in the upper right corner of the code repository list page. The SSH Keys page is displayed.

  5. In Key Name, enter a name for your new key. Paste the SSH public key copied in 3 to Key and click OK. The message "The key has been set successfully. Click Return immediately, automatically jump after 3s without operation" is displayed, indicating that the key is set successfully.

Related Document

  • If Failed to add the key. Check whether the key is valid. is displayed, the entered key is invalid. If the key is manually copied from the local host, redundant spaces may have been copied or the copied key is incomplete. In this case, reconfigure the key by referring to 3.
  • When you configure an SSH key, the following message is displayed: SSH Key Already Exists, indicating that the key has been added to the account or another account. Solution: Generate a new SSH key locally by referring to the preceding steps and configure the generated key in CodeArts Repo.
  • CodeArts Repo provides an API to obtain the SSH key list. For details, see Obtaining the SSH Key List.
  • CodeArts Repo provides an API to obtain the SSH key list. For details, see Adding an SSH Key.
  • CodeArts Repo provides an API to obtain the SSH key list. For details, see Adding an SSH Key.

Video Tutorial