argoproj / argo-cd

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

Error: failed to initialize repository resources #17918

Open DhamodharReddy opened 7 months ago

DhamodharReddy commented 7 months ago

Discussed in https://github.com/argoproj/argo-cd/discussions/17917

Originally posted by **DhamodharReddy** April 22, 2024 I wanted to bring up an issue I've encountered with the Argocd application I've been working on. Everything was working perfectly on Argocd for a while, but lately getting the error. This error is only for few applications. Whenever I try to sync the application, getting below error. **_" Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = failed to initialize repository resources: rpc error: code = Internal desc = Failed to fetch default: git fetch origin --tags --force --prune failed timeout after 1m30s."_** I haven't found a solution yet. Any insights or suggestions on how to resolve this?
bhageshpuri commented 5 months ago

i am facing the same issue

Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = failed to initialize repository resources: rpc error: code = Internal desc = Failed to fetch default: git fetch origin --tags --force --prune failed exit status 128: fatal: fetch-pack: invalid index-pack output

mcapala commented 2 months ago

Check if in repository pod/container you have HOME environment variable set to /home/argocd. Not sure if it was in latest argocd image from redhat, or gitops-operator, but something did set it to HOME=/ instead. When you tried to pull image it tried to create .ssh folder in /.ssh, and git crashed. If you use gitops-operator in openshift, fix is to set this in your ArgoCD resource:

spec:
  repo:
    env:
      - name: HOME
        value: /home/argocd