argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

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

Open criscola opened this issue 2 years ago • 4 comments

Checklist:

  • [x] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • [x] I've included steps to reproduce the bug.
  • [x] I've pasted the output of argocd version.

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 [email protected]: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

criscola avatar Jun 03 '22 07:06 criscola

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

Dentrax avatar Jun 15 '22 14:06 Dentrax

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

tliechti avatar Sep 05 '22 12:09 tliechti

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

pschichtel avatar May 21 '23 23:05 pschichtel

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

zimmertr avatar Mar 09 '24 00:03 zimmertr