Bootstrap FreeKB - ArgoCD - Add repos Credentials using the CLI
ArgoCD - Add repos Credentials using the CLI

Updated:   |  ArgoCD articles

Let's say you have multiple repos, perhaps something like this.

https://github.com/acme/foo.git
https://github.com/acme/bar.git
https://github.com/acme/hello.git
https://github.com/acme/world.git

 

And each of these repos can be added to ArgoCD using the same credentials, such as the same username and password.

argocd repo add https://github.com/acme/foo.git    --username john.doe --password itsasecret
argocd repo add https://github.com/acme/bar.git   --username john.doe --password itsasecret
argocd repo add https://github.com/acme/hello.git --username john.doe --password itsasecret
argocd repo add https://github.com/acme/world.git --username john.doe --password itsasecret

 

Or the same token.

argocd repo add https://github.com/acme/foo.git   --username ' '  --password 'ghp_ggEVZkS0N2mzlGABCK0pO3C123CSmS0oFNeX'
argocd repo add https://github.com/acme/bar.git   --username ' '  --password 'ghp_ggEVZkS0N2mzlGABCK0pO3C123CSmS0oFNeX'
argocd repo add https://github.com/acme/hello.git --username ' '  --password 'ghp_ggEVZkS0N2mzlGABCK0pO3C123CSmS0oFNeX'
argocd repo add https://github.com/acme/world.git --username ' '  --password 'ghp_ggEVZkS0N2mzlGABCK0pO3C123CSmS0oFNeX'

 

Or the same SSH key.

argocd repo add git@github.com:acme/foo.git   --ssh-private-key-path $HOME/.ssh/argocd
argocd repo add git@github.com:acme/bar.git   --ssh-private-key-path $HOME/.ssh/argocd
argocd repo add git@github.com:acme/hello.git --ssh-private-key-path $HOME/.ssh/argocd
argocd repo add git@github.com:acme/world.git --ssh-private-key-path $HOME/.ssh/argocd

 

This is a good scenario to add a Credential Template to ArgoCD so that when adding repo's to ArgoCD you don't need to include the username and password or token or SSH key and instead the repo will be added using the Credential Template. The argocd repocreds add command can be used to add a Credential Template to ArgoCD.

argocd repocreds add https://github.com/acme --username ' '  --password 'ghp_ggEVZkS0N2mzlGABCK0pO3C123CSmS0oFNeX'

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 63f1cf in the box below so that we can be sure you are a human.