argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.77k stars 5.42k forks source link

Failed to sync: unexpected client error: unexpected requesting status code 301 #9574

Open criscola opened 2 years ago

criscola commented 2 years ago

Checklist:

Describe the bug

When trying to sync repos, I get rpc error: code = Unknown desc = unexpected client error: unexpected requesting "https://gitlab.com/criscola/capi-gce-demo-argocd/info/refs?service=git-upload-pack" status code: 301

I've had a look at this of course: https://github.com/argoproj/argo-cd/issues/2640 but it didn't solve my problem.

To Reproduce

I added my repository like that: argocd repo add git@gitlab.com:criscola/capi-gce-demo-argocd.git --ssh-private-key-path ~/.ssh/id_ed25519

I then switched to using HTTPS and it worked. As you can see I've added the suffix .git to the repo's URL.

Expected behavior

My Applications should sync fine.

Screenshots

-

Version

argocd: v2.3.4+unknown
  BuildDate: 2022-05-20T05:06:57Z
  GitCommit: 
  GitTreeState: 
  GitTag: 2.3.4
  GoVersion: go1.18.2
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.3.4+ac8b7df
  BuildDate: 2022-05-18T11:41:37Z
  GitCommit: ac8b7df9467ffcc0920b826c62c4b603a7bfed24
  GitTreeState: clean
  GoVersion: go1.17.10
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: v0.13.1
  Kustomize Version: v4.4.1 2021-11-11T23:36:27Z
  Helm Version: v3.8.0+gd141386
  Kubectl Version: v0.23.1
  Jsonnet Version: v0.18.0

Logs

-

Dentrax commented 2 years ago

I think ArgoCD should automatically add .git suffix if does not exist in repo's URL.

tliechti commented 2 years ago

This error also occurs if the repo is empty and argocd is trying to connect to it (with .git in the url)

pschichtel commented 1 year ago

This also occurs after migrating my git host to a new domain. why doesn't it "simply" follow redirects?

zimmertr commented 7 months ago

This also happens when you try and use a private repo for which you don't have a credential secret defined.

crstian19 commented 1 month ago

This error also occurs if the repo is empty and argocd is trying to connect to it (with .git in the url)

.git is the answer