All Products
Search
Document Center

Container Service for Kubernetes:Manage Git repositories

Last Updated:Jul 11, 2023

This topic describes how to add a Git repository to or remove a Git repository from the GitOps system, and how to view Git repositories that are added to the GitOps system.

Prerequisites

You are logged on to the GitOps system. For more information, see Log on to the GitOps system.

Add a Git repository to the GitOps system

You can use one of the following methods to add a Git repository to the GitOps system:

  • Run the following command to add a Git repository to the GitOps system:

    argocd repo add https://github.com/AliyunContainerService/gitops-demo.git

    Expected output:

    Repository 'https://github.com/AliyunContainerService/gitops-demo.git' added
  • Run the following command to use a username and a password to add a Git repository to the GitOps system:

    argocd repo add https://git.example.com/repos/repo --username git --password secret
  • Run the following command to use a private key and SSH to add a Git repository to the GitOps system:

    argocd repo add git@git.example.com:repos/repo --insecure-ignore-host-key --ssh-private-key-path ~/id_rsa

Run the following command to query the help information of the argocd repo add command:

argocd repo add --help

View the Git repositories in the GitOps system

Run the following command to query the Git repositories in the GitOps system:

argocd repo list

Expected output:

TYPE  NAME  REPO                                                INSECURE  OCI    LFS    CREDS  STATUS      MESSAGE  PROJECT
git         https://github.com/AliyunContainerService/gitops-demo.git  false     false  false  false  Successful

Remove a Git repository from the GitOps system

Run the following command to remove a Git repository from the GitOps system:

argocd repo rm https://github.com/AliyunContainerService/gitops-demo.git

Expected output:

Repository 'https://github.com/AliyunContainerService/gitops-demo.git' removed