<p>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 <code>Application</code> that looks like this:</p>
<pre><code>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
</code></pre>
<p>And a corresponding secret with the secret key that looks like this:</p>
<pre><code>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
</code></pre>
<p>ArgoCD fails to sync this app and shows the following error:</p>
<pre><code>rpc error: code = Unknown desc = error creating SSH agent: &quot;SSH agent
requested but SSH_AUTH_SOCK not-specified&quot;
</code></pre>
<p>I understand what that's telling me, but I'm not sure how to correct
the problem in the context of ArgoCD.</p>

<p>You can review possible causes from <a href="https://github.com/argoproj/argo-cd/issues/1172" rel="nofollow noreferrer"><code>argoproj/argo-cd</code> issue 1172</a></p>
<p>Since you have the proper URL (<code>ssh://git@github.com/...</code>, as requested by <a href="https://github.com/operate-first/argocd-apps/pull/203" rel="nofollow noreferrer">PR 203</a>), double-check the indentation:</p>
<blockquote>
<p>It was an identation problem caused by me :) in the <code>repositories.yaml</code> causing a wrong unmarshalling and a empty <code>sshPrivateKeySecret</code>.<br />
The right version is here:</p>
<pre class="lang-yaml prettyprint-override"><code>- sshPrivateKeySecret:
   key: sshPrivateKey
   name: bitbucket
 url: git@bitbucket.org:MY-PROJECT/MY-REPO
</code></pre>
</blockquote>
