ArgoCD failing to sync with "SSH agent requested but SSH_AUTH_SOCK not-specified"
Asked Answered
S

3

6

We have been happily using ArgoCD with public repositories for a while, but we've run into problems trying to connect ArgoCD to a private repository. We have an Application that looks like this:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: example-app
  namespace: argocd
spec:
  destination:
    name: example-cluster
    namespace: open-cluster-management-agent
  project: ops
  source:
    path: .
    repoURL: ssh://[email protected]/example-org/example-repo.git
    targetRevision: HEAD
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
    - Validate=false
    - ApplyOutOfSyncOnly=true

And a corresponding secret with the secret key that looks like this:

apiVersion: v1
metadata:
  labels:
    argocd.argoproj.io/secret-type: repository
  name: example-repo
  namespace: argocd
type: Opaque
stringData:
  sshPrivateKey: |
    -----BEGIN OPENSSH PRIVATE KEY-----
    ...
    -----END OPENSSH PRIVATE KEY-----
  url: ssh://[email protected]/example-org/example-repo.git
kind: Secret

ArgoCD fails to sync this app and shows the following error:

rpc error: code = Unknown desc = error creating SSH agent: "SSH agent
requested but SSH_AUTH_SOCK not-specified"

I understand what that's telling me, but I'm not sure how to correct the problem in the context of ArgoCD.

Sheaves answered 15/9, 2021 at 21:0 Comment(2)
Seems to be ssh-only, not really Git. But it's a bit weird, what's requesting the ssh agent?Idomeneus
I think this might be version skew; we're running argocd 2.0.x and I think the docs are for a newer version. I'm going to check version appropriate docs today and see if something has changed between the two.Sheaves
G
4

You can review possible causes from argoproj/argo-cd issue 1172

Since you have the proper URL (ssh://[email protected]/..., as requested by PR 203), double-check the indentation:

It was an identation problem caused by me :) in the repositories.yaml causing a wrong unmarshalling and a empty sshPrivateKeySecret.
The right version is here:

- sshPrivateKeySecret:
   key: sshPrivateKey
   name: bitbucket
 url: [email protected]:MY-PROJECT/MY-REPO
Gallicanism answered 16/9, 2021 at 5:56 Comment(0)
A
1

I run into the same issue recently, with not being able to use ssh to access my Azure repo from Argo. The fix for me was to upgrade Argo from v2.8.3 to v2.11.3.

Angadreme answered 28/6 at 0:4 Comment(0)
P
0

Another scenario:

The exact same error can also occur in a situation where the Root application is pointing to a wrong git url.

Peaceful answered 19/9 at 18:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.