Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding a private repo declaratively shows error SSH agent requested but SSH_AUTH_SOCK not-specified #1172

Closed
narg95 opened this issue Feb 25, 2019 · 6 comments

Comments

@narg95
Copy link
Contributor

narg95 commented Feb 25, 2019

Description

Adding a private repository, using a ssh-key in a secret to autenticate, by a declarative approach fails with SSH agent requested but SSH_AUTH_SOCK not-specified.

argocd repo list
REPO                                        USER  STATUS  MESSAGE
git@bitbucket.org:MY-PROJECT/MY-REPO.git        Failed  Unable to connect to repository: error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"

NOTE

If added by the command-line argocd repo add git@bitbucket.org:MY-PROJECT/MY-REPO.git --ssh-private-key-path key/id_rsa_bitbucket:

  • It works if there are no previous attempts to add it declaratively
  • it does not work if it was first added declaratively and then deleted with argocd repo rm git@bitbucket.org:MY-PROJECT/MY-REPO.git and then added with the command above.

Files

kustomization.yaml

bases:
- github.com/argoproj/argo-cd//manifests/cluster-install?ref=v0.11.2

configMapGenerator:
- name: argocd-cm
  behavior: merge
  files:
  - repositories=repositories.yaml

secretGenerator:
- name: bitbucket
  files:
  - sshPrivateKey=key/id_rsa_bitbucket

generatorOptions:
  disableNameSuffixHash: true

repositories.yaml

- sshPrivateKeySecret:
  key: sshPrivateKey
  name: bitbucket
  url: git@bitbucket.org:MY-PROJECT/MY-REPO

a valid key is set in the path key/id_rsa_bitbucket, this key works because as explained above, it works if added by the command line.

Expected Behavior

argocd repo list
REPO                                        USER  STATUS      MESSAGE
git@bitbucket.org:MY-PROJECT/MY-REPOgit        Successful

UPDATE

  1. 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
  1. There is a caching issue with the repo service, when it is deleted it is not removed from the cache of the connection status. This PR invalidate repo cache on delete #1182 fixes it
@narg95 narg95 closed this as completed Feb 26, 2019
@neoakris
Copy link

neoakris commented Jan 26, 2021

(Not trying to revive a dead post, but I had the same issue and found this page via google, I'm posting on this closed thread incase it helps other future googlers.)

I think there was a change in a newer version of argocd.
I had the exact same error message, and it didn't go away for me

until I changed my url from
url: git@10.10.10.10:22/home/git/bootstrap.git

to have ssh:// in the front

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: example
spec:
  project: default
  source:
    repoURL: 'ssh://git@10.10.10.10:22/home/git/bootstrap.git'
    ...

(Also note worthy is that without ssh:// used to work for me in a previous version of ArgoCD)

@aeckard87
Copy link

@neoakris could you provide more details on your situation to give better insight on how you found this?

What version of argocd, declarative setup or used argocd cli?

env information??

TIA

@neoakris
Copy link

argocd:v1.7.8
declarative yaml setup
RKE2 on AWS

I don't have access to the cluster that it used to run on but I know it was an older version of argo on that cluster

@grtrout
Copy link

grtrout commented Feb 10, 2021

Just FYI... this is pretty obvious and maybe no one else has encountered the same problem as me. However, I wanted to add this here just in case it saves someone a few minutes of troubleshooting.

I originally set up my repositories in ArgoCD using SSH keys. I recently started using 'deploy tokens' in GitLab and this seems like a better solution overall. Long story short, in the CRDs for my applications, I forgot to change the 'repoURL' properties from the SSH to the HTTPS URIs. Changing them fixed this immediately.

larsks added a commit to operate-first/argocd-apps that referenced this issue Sep 15, 2021
When trying to access a private repository, argo is failing with:

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

There is a comment in [1] that suggests this can be resolved by using
a different URL format.

[1]: argoproj/argo-cd#1172 (comment)
larsks added a commit to larsks/moc-apps that referenced this issue Sep 15, 2021
When trying to access a private repository, argo is failing with:

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

There is a comment in [1] that suggests this can be resolved by using
a different URL format.

[1]: argoproj/argo-cd#1172 (comment)
larsks added a commit to larsks/moc-apps that referenced this issue Sep 15, 2021
When trying to access a private repository, argo is failing with:

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

There is a comment in [1] that suggests this can be resolved by using
a different URL format.

[1]: argoproj/argo-cd#1172 (comment)
larsks added a commit to larsks/argocd-apps that referenced this issue Sep 15, 2021
When trying to access a private repository, argo is failing with:

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

There is a comment in [1] that suggests this can be resolved by using
a different URL format.

[1]: argoproj/argo-cd#1172 (comment)
@Talador12
Copy link

Talador12 commented Jun 16, 2022

To clarify this comment with the docs:

(Not trying to revive a dead post, but I had the same issue and found this page via google, I'm posting on this closed thread incase it helps other future googlers.)

I think there was a change in a newer version of argocd. I had the exact same error message, and it didn't go away for me

until I changed my url from url: git@10.10.10.10:22/home/git/bootstrap.git

to have ssh:// in the front

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: example
spec:
  project: default
  source:
    repoURL: 'ssh://git@10.10.10.10:22/home/git/bootstrap.git'
    ...

(Also note worthy is that without ssh:// used to work for me in a previous version of ArgoCD)

From the documentation:

When your SSH repository is served from a non-standard port, you have to use ssh://-style URLs to specify your repository.
The scp-style git@yourgit.com:yourrepo URLs do not support port specification, and will treat any port number as part of the repository's path.

That :22 port means you have to have a ssh:// in the front

@chinnu0209
Copy link

Just FYI... this is pretty obvious and maybe no one else has encountered the same problem as me. However, I wanted to add this here just in case it saves someone a few minutes of troubleshooting.

I originally set up my repositories in ArgoCD using SSH keys. I recently started using 'deploy tokens' in GitLab and this seems like a better solution overall. Long story short, in the CRDs for my applications, I forgot to change the 'repoURL' properties from the SSH to the HTTPS URIs. Changing them fixed this immediately.

Hello, I am facing an issue with being unable to connect GitLab private with argocd, I used sssh and passed secret and configmap but still, authentication failed can you please explain what could be the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants