解决 ArgoCD 报错 repository not found authentication failed 凭证失效修复
排查 ArgoCD 添加私有 Git 仓库提示 authentication failed 或 repository not found,分析 SSH 私钥换行与已知主机指纹。
问题现象
向 ArgoCD 注册 Git 存储库时抛出拒绝连接错误:
Unable to resolve 'git@gitlab.internal:group/repo.git': authentication required but no CredentialsProvider was registered
或:
Failed to test repository connection: repository not found
触发根因
- 配置的 SSH 私钥未包含标准的首尾边界(
-----BEGIN OPENSSH PRIVATE KEY-----)或换行符在复制时被压缩为单行; - ArgoCD Reposerver 容器缺少对私有自建 GitLab 主机的 SSH 主机密钥指纹信任。
解决步骤
标准化 SSH 私钥内容
确保私钥格式完整且具备正确换行:
argocd repo add git@gitlab.internal:group/repo.git \
--ssh-private-key-path ~/.ssh/id_ed25519 \
--insecure-ignore-host-key
若使用自签名 HTTPS,提供 CA 证书
使用 --tls-client-cert-path 或添加公钥指纹。
验证确认
查看仓库连接状态:
argocd repo list
STATUS 显示为 Successful,应用代码被准时拉取解析。


