https://garden.io logo
#🌱|help-and-getting-started
fatal: this operation must be run in a work tree
# 🌱|help-and-getting-started
b

bored-grass-81679

05/05/2023, 12:06 PM
Hi, One of my coworkers has been getting the following error when running garden dev and cannot use his dev environment because of it.
Copy code
/snapshot/project/tmp/pkg/cli/node_modules/execa/lib/error.js:59
        error = new Error(message);
          ^
Error: Command "git status" failed with code 128:
fatal: this operation must be run in a work tree
    at makeError (/snapshot/project/tmp/pkg/cli/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/snapshot/project/tmp/pkg/cli/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at exec (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/util/util.ts:231:17)
    at /snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/vcs/git.ts:97:26
    at wrapped.ensureSafeDirGitRepo (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/vcs/git.ts:162:7)
    at wrapped.getRepoRoot (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/vcs/git.ts:205:5)
    at wrapped.getFiles (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/vcs/git.ts:269:21)
    at findConfigPathsInPath (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/util/fs.ts:175:17)
    at /snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/src/watch.ts:298:29
Here is more context about our setup and about the encountered problem: - Garden version: 0.12.55 - We include 3 remote sources in the garden.project.yaml file. - We have a deployment bash script which runs
garden link source
on those remote sources and then
garden dev
- The problem is sadly only reproducible on my coworkers MacOS laptop at the moment. - We tried running
git status
inside .garden/sources/ as the problem happened and it worked fine. I would appreciate any leads on this since it's affecting my coworker's productivity by quite a lot. 😦
b

bright-policeman-43626

05/05/2023, 2:09 PM
Oh no! I'm so sorry to hear this @bored-grass-81679, please bear with me and let's try some quick fix to try to debug this issue. 1. Do you mind removing the .garden folder
rm -fr .garden
2. Do you mind trying to clone the repo again, perhaps the .git folder is corrupted?
Does this work with a different version of Garden? ❤️
b

bored-grass-81679

05/05/2023, 2:15 PM
Hey @bright-policeman-43626. Thanks for the quick reply! I forwarded your message to my colleague and will report back once I know if it worked out. It might be that it just happens in v0.12.55. We'll see!
b

bright-policeman-43626

05/05/2023, 2:26 PM
It would be really good to try v0.12.54 as well?
For sure, I hope everything ends up working good! Feel free to invite your colleague to Discord so we can pair/debug this one out 🙂
b

bored-grass-81679

05/05/2023, 3:37 PM
We have noticed that the problem only happens when switching branches. Deleting .garden and restarting usually fixes the problem.
b

bright-policeman-43626

05/08/2023, 2:55 PM
Have you encountered a similar issue before? @quaint-dress-831 I think I recall seeing a similar behaviour when switching branches?
q

quaint-dress-831

05/08/2023, 3:02 PM
I've never encountered this issue 🤔
We may want to escalate
If your proposed solution didn't work for Iceborn's colleague
@bored-grass-81679 you may try deleting any
.garden
folders both within current working and below with
find . -type d -name .garden -exec rm -r {} +
b

bored-grass-81679

07/12/2023, 7:13 AM
@quaint-dress-831 You asked me about the git related issue that caused us to add ".garden" removal to our deployment script. Its this one.
q

quaint-dress-831

07/21/2023, 3:03 PM
@bored-grass-81679 just checking in: have you encountered this since?
b

bored-grass-81679

07/25/2023, 8:43 AM
@quaint-dress-831 No I think it never happened again 🙂
69 Views