In this article I'll share a step by step of how to add ssh
authentication to a private Github repository:
Create the key pair (select empty passphrases on prompt)
ssh-keygen -t ed25519 -C "mateo.cuervo@example.com" -f ~/.ssh/argocd_ed25519
Copy the public key
cat ~/.ssh/argocd_ed25519.pub
Go to your Github repo, you should be admin, then click on "Settings" then on "Deploy keys" and finally save the key copied in last step.
Now copy the private key part
cat ~/.ssh/argocd_ed25519
Create a kubernetes secret with the key final result should look something like this:
apiVersion: v1
kind: Secret
metadata:
name: repo-secret
namespace: argocd
labels:
# This annotation let's ArgoCD know it's for repository authentication
argocd.argoproj.io/secret-type: repository
stringData:
url: git@github.com:cooervo/my-repo-name.git
sshPrivateKey: |
-----BEGIN OPENSSH PRIVATE KEY-----
...
-----END OPENSSH PRIVATE KEY-----
insecure: "false"
Deploy the secret in your cluster. Next open your ArgoCD server UI navigate to "Settings" > "Repository", your repo should be connected: