Help Center> CodeHub> User Guide> Cloud Repository Creation> Creating a Repository Using a Template
Updated on 2023-03-09 GMT+08:00

Creating a Repository Using a Template

You can create a repository using a CodeHub template on the CodeHub console.

Prerequisites

This operation must be performed in the Scrum template project.

Procedure

  1. Go to the CodeHub repository list and switch to your region.
  2. Click next to Create Directly and select Use Template from the drop-down list. The Use Template page is displayed.

  3. On the Use Template page, enter a keyword for fuzzy search and select a template as required.
  4. Click Next. On the Create Repository page, enter basic repository information.

    Table 1 Parameters for creating a repository using a template

    Parameter

    Mandatory

    Remarks

    Repository Name

    Yes

    A name contains letters, digits, underscores (_), periods (.), and hyphens (-) and must start with a letter, digit, or underscore (_).

    Project

    Yes

    • A repository must be associated with a project.
    • If you create a repository in a project, the project is selected for Project by default, and the Project parameter is hidden on the repository creation page.
    • If there is no project under the account or you click Create Project in the Project drop-down list, the Create Project dialog box is displayed and you can create a basic project.

    (For a basic project, only CodeHub and CodeCheck can be used. Other services are not enabled or displayed. You can change a project to a basic project on the project settings page.)

    Description

    No

    Enter the description of your repository.

    Permissions

    No

    The options are as follows:

    • Allow project members to access the repository

      The project manager is automatically set as the repository administrator, and the developer is set as a common repository member. When members of the two roles are added to the project, they are added to the repository member list by automatic synchronization. You can view the list.

    • Allow generation of a README file

      You can edit the README file to record information such as the project architecture and compilation purpose, which is similar to a comment on the entire repository.

    Visibility

    Yes

    The options are as follows:

    • Private

      The repository is visible only to repository members. Repository members can access the repository or commit code.

    • Public read-only

      The repository is open and read-only for all visitors. You can view and pull code on the web page, but cannot push code to the repository. You can select an open-source license as the remarks.

  5. Click OK to create the repository.
  6. After the repository is created, the repository list page is displayed.

When you create a repository by template, the repository type of the selected template will be automatically configured for the repository.

The repository created using the template contains the repository file structure preset in the template.

Automatically Creating a Pipeline

A pipeline can be automatically created when a repository is created using a template. Note that the host used in CloudDeploy must be changed to the actual environment so that the pipeline can be successfully executed.

  1. On CodeHub, click next to Create Directly and select Use Template.

  2. On the Select Template page, set Automated Pipeline Creation to Yes in the navigation pane to display templates that can be used to automatically create a pipeline.

  3. Select a template as required, click Next, enter basic repository information, and click OK.
  4. After the repository is created, you can view the pipeline that is automatically created on the pipeline list page displayed.