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

9/15/2021

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://git@github.com/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://git@github.com/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.

-- larsks
argocd
git
gitops
kubernetes
ssh

1 Answer

9/16/2021

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

Since you have the proper URL (ssh://git@github.com/..., 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: git@bitbucket.org:MY-PROJECT/MY-REPO
-- VonC
Source: StackOverflow