Import a Code Repository

In KubeSphere 3.3.0, you can import a GitHub, GitLab, Bitbucket, or Git-based repository. The following describes how to import a GitHub repository.

Prerequisites

Procedures

  1. Log in to the KubeSphere console as project-regular. In the navigation pane on the left, click DevOps Projects.

  2. On the DevOps Projects page, click the DevOps project you created.

  3. In the navigation pane on the left, click Code Repositories.

  4. On the Code Repositories page, click Import.

  5. In the Import Code Repository dialog box, enter a name of the code repository, and then select a GitHub repository. Optionally, you can set an alias and add description.

    The following table lists supported code repositories and parameters to set.

    Code RepositoryParameter
    GitHubCredential: Select the credential of the code repository.
    GitLab
    • GitLab Server Address: Select the GitLab server address, and the default value is https:gitlab.com.
    • Project Group/Owner: Enter the GitLab username.
    • Credential: Select the credential of the code repository.
    • Code Repository: Select the code repository.
    Bitbucket
    • Bitbucket Server Address: Set the Bitbucket server address.
    • Credential: Select the credential of the code repository.
    Git
    • Code Repository URL: Enter the URL of the code repository.
    • Credential: Select the credential of the code repository.

    Note

    To use a private GitLab repository, please refer to Create a Multi-branch Pipeline with GitLab-Step 4.

  6. In Credential, click Create Credential. In the Create Credential dialog box, set the following parameters:

    • Name: Enter a name of the credential, for example, github-id.
    • Type: Optional values include Username and password, SSH key, Access token, and kubeconfig. In DevOps projects, Username and password is recommended.
    • Username: The default username is admin.
    • Password/Token: Enter your GitHub token.
    • Description: Add description.

    Note

    For more information about how to create a credential, please refer to Credential Management.

  7. In the GitHub repositories that are displayed, select a repository, and click OK.

  8. Click Import a Code Repository - 图1 on the right of the imported code repository, and you can perform the following operations:

    • Edit: Edits the alias and description of the code repository and reselects a code repository.
    • Edit YAML: Edits the YAML file of the code repository.
    • Delete: Deletes the code repository.