Guild error - Not a git repository

fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File “/home/sjoshi/anaconda3/envs/clip/.guild/runs/894a22b5465840858109bc4504a0295c/.guild/sourcecode/”, line 46, in
args.git_hash = subprocess.check_output([‘git’, ‘rev-parse’, ‘HEAD’])
File “/home/sjoshi/anaconda3/envs/clip/lib/python3.10/”, line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/home/sjoshi/anaconda3/envs/clip/lib/python3.10/”, line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘[‘git’, ‘rev-parse’, ‘HEAD’]’ returned non-zero exit status 128.

Your code is running inside another directory, not your project directory. The new directory is not a git repo, which is why you’re seeing this error.

I created a doc that describes what’s going on and gives you some working code to use if you need it:

The approach here is to include your git repo as a dependency for the build. The example provides examples of copying the repo (expensive but safe - there’s no chance of getting different results depending on when the code is run) and linking (efficient but sensitive to when you run the code).

1 Like

Thanks for the prompt response!

1 Like