管理Git源仓库

更新时间: 2023-07-11 14:31:24

本文介绍如何在GitOps系统中添加、查看及删除Git源仓库。

前提条件

已登录GitOps系统。具体操作,请参见登录GitOps系统

添加Git源仓库

您可以通过以下几种方式添加Git源仓库。

  • 执行以下命令,添加示例应用的Git源仓库到GitOps系统中。

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

    预期输出:

    Repository 'https://github.com/AliyunContainerService/gitops-demo.git' added
  • 使用用户名密码,通过HTTPS添加私有Git源仓库的示例如下。

    argocd repo add https://git.example.com/repos/repo --username git --password secret
  • 使用私钥证书,通过SSH协议添加Git源仓库并忽略服务器证书校验的示例如下。

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

执行以下命令,查看更多参数的使用说明。

argocd repo add --help

查看Git源仓库

执行以下命令,查看Git源仓库列表。

argocd repo list

预期输出:

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

删除Git源仓库

执行以下命令,删除Git源仓库。

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

预期输出:

Repository 'https://github.com/AliyunContainerService/gitops-demo.git' removed
阿里云首页 容器服务 Kubernetes 版 ACK 相关技术圈