本文介绍如何在GitOps系统中添加、查看及删除Git源仓库。
前提条件
已登录GitOps系统。具体操作,请参见登录GitOps系统。
添加Git源仓库
您可以通过以下几种方式添加Git源仓库。
- 执行以下命令,添加示例应用的Git源仓库到GitOps系统中。
argocd repo add https://github.com/AliyunContainerService/gitops-demo.git
说明 若由于网络原因导致您无法访问GitHub,您也可以将https://github.com/AliyunContainerService/gitops-demo.git
替换为https://code.aliyun.com/shuwei.hsw/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