If you use the Secure Shell (SSH) protocol to access a code repository, add the Cloud Build SSH public key to the repository. This topic uses GitLab as an example to describe how to set an SSH key. The procedure is similar for other code repositories, such as Aliyun Code and GitHub.
Prerequisites
You have an SSH public key. For more information, see Add code access permissions.
ImportantAn SSH public key is sensitive information. Keep it confidential.
You are logged in to GitLab.
Procedure
Click your profile picture in the upper-right corner and select Edit profile from the shortcut menu to open the User Settings page.

In the left navigation pane of the User Settings page, open the SSH Keys tab.

On the SSH Keys tab, add the Cloud Build SSH public key and configure the parameters.
Parameter name
Description
Key
Enter the Cloud Build SSH public key. For information about how to obtain the key, see Add code access permissions.
Title
Set a title for the SSH key.
Expiration date
Set an expiration date for the SSH key.
Click Add key to save the settings.