4

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.

torek
  • 448,244
  • 59
  • 642
  • 775
larsks
  • 277,717
  • 41
  • 399
  • 399
  • Seems to be ssh-only, not really Git. But it's a bit weird, what's requesting the ssh agent? – torek Sep 16 '21 at 02:46
  • 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. – larsks Sep 16 '21 at 14:26

1 Answers1

2

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
  • 1,262,500
  • 529
  • 4,410
  • 5,250