This document describes how to configure SSH public keys.
Open Project
1. Log in to the CODING Console and click the team domain name to go to CODING.
2. Click in the upper-right corner to open the project list page and click a project icon to open the corresponding project. 3. In the menu on the left, select Code Repositories.
4. If Code Repositories is not shown on the left, the project admin needs to go to Project Settings > Projects and Members > Functions to enable the relevant function.
Function Overview
SSH stands for Secure Shell. It is an encryption protocol used for network communication. SSH provides a secure data transmission environment in a public network environment. It is generally used to log in to a remote host and push/pull code.
You can add an SSH public key to a code repository, where it is called a public deploy key. Then, this key will grant read-only permission for this project by default. If you add the key to a personal account, it is called an SSH public key. It grants read/write permission to all projects under the account. The same SSH public key cannot be added to code repositories or personal accounts more than once.
Generate Public Key
Here, we use the ssh-keygen
tool to generate an SSH public key. Run the following command:
ssh-keygen -m PEM -t rsa -b 4096 -C "your.email@example.com" // Creates a new SSH key pair (public key/private key). Enter your email as the tag.
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter] // We recommend using the default address
Enter passphrase (empty for no passphrase): // Here, just press Enter. If you set a passphrase, you will need to enter the passphrase every time you push code using SSH.
Note:
If you need multiple SSH key pairs, when you are prompted to Enter file in which to save the key
, enter a new file name, so the existing key pair will not be overwritten. For more information about SSH, see Wikipedia. After the operation succeeds, you will see the following information:
Your identification has been saved in /Users/you/.ssh/id_rsa.
Add Public Key
You can add a public key to a code repository or personal account.
Associate public key with code repository
1. Go to the key pair address generated above (generally ~/.ssh/
) and find the public key file with the pub
extension. Use the cat
command to output all content and copy the content.
2. Open the code repository and go to Settings > Public Deploy Key. Click Add Public Deploy Key and paste the full text of the public key.
Note:
Public deploy keys have read-only permission to the project by default. Select Grant Push Permission in the public deploy key settings to obtain push permission.
3. Then, the first time you attempt to connect from your local device, run the public key authentication command: ssh -T git@e.coding.net
Associate public key with personal account
1. Go to the key pair address generated above (the default address is generally ~/.ssh/
) and find the public key file with the pub
extension. Use the cat
command to output all content and copy the content.
2. Log in to CODING, click your profile photo in the upper-right corner, and go to Personal Account Settings > SSH Public Keys. Then, click Create Public Key.
3. Follow the instructions to paste the public key content you copied and enter a name for the public key.
4. Then, the first time you attempt to connect from your local device, run the public key authentication command: ssh -T git@e.coding.net
.
Was this page helpful?