Skip to content

"pre-commit install" fails

Hi all,

For some reason I'm not being able to set up pre-commit. this is the output:

(quantify) PS G:\My Drive\Code\quantify-core> pre-commit install 
An error has occurred: FatalError: git toplevel unexpectedly empty! make sure you are not inside the `.git` directory of your repository.
Check the log at C:\Users\Diogo\.cache\pre-commit\pre-commit.log

And the contents of pre-commit.log:

### version information

pre-commit version: 2.12.1
sys.version:
    3.7.10 (default, Feb 26 2021, 13:06:18) [MSC v.1916 64 bit (AMD64)]
sys.executable: c:\users\diogo\anaconda3\envs\quantify\python.exe
os.name: nt
sys.platform: win32

### error information

An error has occurred: FatalError: git toplevel unexpectedly empty! make sure you are not inside the `.git` directory of your repository.

Traceback (most recent call last):
  File "c:\users\diogo\anaconda3\envs\quantify\lib\site-packages\pre_commit\error_handler.py", line 65, in error_handler
    yield
  File "c:\users\diogo\anaconda3\envs\quantify\lib\site-packages\pre_commit\main.py", line 340, in main
    _adjust_args_and_chdir(args)
  File "c:\users\diogo\anaconda3\envs\quantify\lib\site-packages\pre_commit\main.py", line 157, in _adjust_args_and_chdir
    toplevel = git.get_root()
  File "c:\users\diogo\anaconda3\envs\quantify\lib\site-packages\pre_commit\git.py", line 66, in get_root
    'git toplevel unexpectedly empty! make sure you are not '
pre_commit.errors.FatalError: git toplevel unexpectedly empty! make sure you are not inside the `.git` directory of your repository.

This is not super important, but it's a bit annoying having to wait for the CI to know I forgot to black ..

Edited by Diogo Valada