Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Servers, nginx and Docker

Argo CD will not trust the certificate of a self-hosted Git server

Your error

x509: certificate signed by unknown authority

Fix it fast

Most common cause, 1 of 3

The Git server's private CA was never given to Argo CD

Export the CA certificate (or the server's own certificate if it is self-signed) in PEM form and register it for the hostname.

Fix
argocd cert add-tls git.example.com --from ./company-ca.pem
argocd repo add https://git.example.com/team/deploy.git
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

In Argo CD, x509: certificate signed by unknown authority means the repo server or the argocd CLI met a certificate from a self-signed or private CA it does not know. Add the CA in PEM form with argocd cert add-tls or the argocd-tls-certs-cm ConfigMap, keyed by hostname. For the CLI, trust argocd-server's certificate. Applies to Argo CD 3.6.

  • Applies to Argo CD v3.6.2, argocd CLI v3.6.2
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Note which command shows the error, then list the TLS certificates Argo CD holds for Git servers. An error on argocd login points to cause 3; an error on repo add or in the app's status, with the Git host missing from the list, points to cause 1.

Run this first
argocd cert list --cert-type https

Then find the line you see in this list and open its fix:

  1. 1The Git server's private CA was never given to Argo CDargocd repo add or the Application's condition shows the x509 error, and the Git hostname is not in argocd cert list
  2. 2argocd-tls-certs-cm exists, but Argo CD ignores the entryThe certificate is in the ConfigMap, yet argocd cert list does not show the host or the error stays
  3. 3The argocd CLI does not trust argocd-server's own certificateThe error appears on argocd login, before any Git repository is involved

What does the error look like?

  • x509: certificate signed by unknown authority

Cause 1 of 3

The Git server's private CA was never given to Argo CD

You seeargocd repo add or the Application's condition shows the x509 error, and the Git hostname is not in argocd cert list

Check

Argo CD refuses a Git server over HTTPS when its certificate is self-signed or signed by a CA that Argo CD does not know, and reports x509: certificate signed by unknown authority. With no certificate stored for a host, Argo CD falls back to the system trust store, which covers well-known CAs such as Let's Encrypt but not a company's own root.

Check
openssl s_client -connect git.example.com:443 -showcerts </dev/null

Fix

Export the CA certificate (or the server's own certificate if it is self-signed) in PEM form and register it for the hostname. Certificates are stored per server, not per repository. The --insecure-skip-server-verification flag on repo add also connects, but skips every check, so keep it to throwaway setups.

Fix
argocd cert add-tls git.example.com --from ./company-ca.pem
argocd repo add https://git.example.com/team/deploy.git

Verify

After a minute or two for the change to spread, the repo add call succeeds and the app syncs without the x509 condition.

Verify
argocd app get my-app --hard-refresh

Confirmed by argo-cd.readthedocs.io

Did this fix it?

Cause 2 of 3

argocd-tls-certs-cm exists, but Argo CD ignores the entry

You seeThe certificate is in the ConfigMap, yet argocd cert list does not show the host or the error stays

Check

The declarative ConfigMap must be named argocd-tls-certs-cm, carry the label app.kubernetes.io/part-of: argocd, and use the bare hostname as each data key. A key such as https://git.example.com/repos/app does not match the server, and a ConfigMap without the label is not used at all.

Check
kubectl -n argocd get configmap argocd-tls-certs-cm -o yaml

Fix

Rename the key to the hostname alone and add the label. The value holds one or more PEM certificates, which also lets you add the next CA before a planned roll-over.

Fix
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-tls-certs-cm
  namespace: argocd
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
data:
  git.example.com: |
    -----BEGIN CERTIFICATE-----
    ...your CA in PEM...
    -----END CERTIFICATE-----

Verify

argocd cert list --cert-type https now shows git.example.com, and a hard refresh of the app clears the error.

Verify
argocd cert list --cert-type https

Confirmed by argo-cd.readthedocs.io

Did this fix it?

Cause 3 of 3

The argocd CLI does not trust argocd-server's own certificate

You seeThe error appears on argocd login, before any Git repository is involved

Check

Without further setup, argocd-server uses an automatically generated self-signed certificate. The CLI on your machine has no reason to trust it, so login and every later command fail the TLS check.

Check
argocd login argocd.example.com

Fix

Install a certificate from a CA your machines already trust in the argocd-server-tls secret (tls.crt and tls.key). Until then, point the CLI at the server's certificate file with --server-crt, or use --insecure only on a test cluster, since it skips both the certificate and the domain check.

Fix
kubectl -n argocd create secret tls argocd-server-tls \
  --cert=./argocd.crt --key=./argocd.key
argocd login argocd.example.com --server-crt ./argocd.crt

Verify

argocd login reports a successful login without --insecure, and argocd app list returns your apps.

Verify
argocd app list

Confirmed by argo-cd.readthedocs.io

Did this fix it?

How do I stop it coming back?

  • Keep the company CA bundle in the same Git repo as the Argo CD install, inside argocd-tls-certs-cm, so a rebuilt cluster trusts the Git server from day one.
  • Load both the current and the next CA into the ConfigMap before the Git server's certificate is replaced.
  • Give argocd-server a certificate from a trusted CA instead of teaching every laptop and CI runner to use --insecure.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.