< img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=3131724&fmt=gif" />

Import Code Repositories

KubeSphere supports importing GitHub, GitLab, Bitbucket, or other Git-based code repositories, such as Gitee. Below is an example of how to import a GitHub repository.

Prerequisites

  • DevOps must have been installed and enabled.

  • A workspace, a DevOps project, and a user (e.g. project-regular) have been created, and the user has been invited to the DevOps project with the operator role. See Role and Member Management.

Steps

  1. Log in to the KubeSphere web console as the project-regular user.

  2. Click Workspace Management and enter your DevOps project.

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

  4. On the right side of the page, click Add.

  5. In the Import Code Repository dialog, enter a code repository name, and click Select a code repository. You can also set an alias and add a description for the code repository.

    The table below lists the supported code repositories and parameter settings. The following steps use GitHub as an example.

    Parameter Description

    GitHub

    Credential: Select the credential for accessing the code repository.

    GitLab

    • GitLab Server Address: Select the GitLab server address, the default value is https://gitlab.com.

    • Project Group/Owner: Enter the GitLab account.

    • Credential: Select the credential for accessing the code repository.

    • Code Repository: Select the code repository.

    Bitbucket

    • Bitbucket Server Address: Set the Bitbucket server address.

    • Credential: Select the credential for accessing the code repository.

    Git

    • Code Repository URL: Enter the code repository address, such as https://gitee.com.

    • Credential: Select the credential for accessing the code repository.

    Note

    For using GitLab private repositories, see Create a Multi-branch Pipeline with GitLab.

  6. In the Credential area, click Create Credential. In the Create Credential dialog that appears, set the following parameters and click OK.

    • Name: Enter a credential name, such as github-id.

    • Type: The values include Username and password, SSH key, Access token, and kubeconfig. In DevOps projects, it is recommended to use Username and password.

    • Username: The default username here is admin.

    • Password/Token: Enter your GitHub token.

    • Description: Add a description.

    Note

    For more information on how to add credentials, see Credential Management.

  7. In the Credential dropdown list, select the created credential and click OK.

  8. In the pop-up GitHub repository, select the code repository and click OK.

  9. Click more on the right side of the code repository, and you can perform the following operations:

    • Edit: Modify the alias and description of the code repository, and reselect the code repository.

    • Edit YAML: Edit the YAML file of the code repository.

    • Delete: Delete the code repository.

Receive the latest news, articles and updates from KubeSphere


Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.

What’s on this Page