Skip to content

Trusting git directory

Reza Khanipour edited this page Aug 22, 2024 · 1 revision

In case you are using directories outside of user's home path, you might face the following error depending to your local Git configuration when enabling the devenv shell:

$ direnv allow
direnv: loading /workspaces/internal-it_hiring_cheflings-python/.envrc
direnv: loading https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc (sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=)
direnv: using devenv
direnv: .envrc changed, reloading
error:
       … while fetching the input 'git+file:///workspaces/internal-it_hiring_cheflings-python'

       error:
       error: opening Git repository '"/workspaces/internal-it_hiring_cheflings-python"': repository path '/workspaces/internal-it_hiring_cheflings-python/' is not owned by current user

✖ Command produced the following output:


Error:   × Command `/nix/store/v29lakrmjm66797m9pb1s96pqmz9dkaz-nix-devenv-2.21.0pre20240412_b24a931/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-
  │ features flakes --option warn-dirty false --keep-going --max-jobs 4 --option eval-cache false print-dev-env --profile /workspaces/internal-it_hiring_cheflings-python/.devenv/
  │ gc/shell` failed with with exit code 1

direnv: failed to build the devenv environment. devenv.nix may contain errors. see above.

To fix it, you can run the following command:

$ git config --global --add safe.directory [PROJECT_DIRECTORY]  # or a parent path
Clone this wiki locally