sphinx-contrib/multiversion

sphinx-multiversion reported: No such file or directory: 'git'

Closed this issue · 1 comments

This might be a stupid question...but I myself just cannot resolve it. Any hints are highly appreciated.

It reported that "No such file or directory: 'git'" , but according to ls I do have the .git folder.

# sphinx-multiversion . _build/html
Traceback (most recent call last):
  File "/usr/local/bin/sphinx-multiversion", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/sphinx_multiversion/main.py", line 188, in main
    git.get_toplevel_path(cwd=sourcedir_absolute)
  File "/usr/local/lib/python3.9/site-packages/sphinx_multiversion/git.py", line 25, in get_toplevel_path
    output = subprocess.check_output(cmd, cwd=cwd).decode()
  File "/usr/local/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git'

# ls -la
total 24
drwxrwxrwx 1 1000 1000  512 Mar  7 06:48 .
drwxr-xr-x 1 root root 4096 Mar  7 06:46 ..
drwxr-xr-x 1 root root  512 Mar  7 06:48 .git
-rwxrwxrwx 1 1000 1000  163 Mar  3 08:27 .gitignore
-rwxr-xr-x 1 root root  580 Apr 25  2021 Makefile
drwxr-xr-x 1 root root  512 Feb 27 08:12 _build
drwxrwxrwx 1 1000 1000  512 Mar  7 06:47 _source
drwxrwxrwx 1 1000 1000  512 Mar  3 08:15 _static
drwxrwxrwx 1 1000 1000  512 Mar  7 06:48 _templates
-rwxrwxrwx 1 1000 1000 6823 Mar  7 06:48 conf.py
-rwxrwxrwx 1 1000 1000 1175 Mar  3 08:27 index.rst
-rwxrwxrwx 1 1000 1000  787 Oct 10 05:56 make.bat

I am using sphinxdoc/sphinx Docker image, commit ID is fa56a26a6d3a7a7305a42ad211936eb1cb635f18d54ceb787a12b24acdc25224. Other environment information:

# pip --version
pip 23.0.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

I've resolved the issue. I installed Git and add the repo. It seems that Git is a dependency for sphinx-multiveresion, while the .git folder alone is not enough.

# git branch
fatal: detected dubious ownership in repository at '/docs'
To add an exception for this directory, call:

        git config --global --add safe.directory /docs
# ls
Makefile  _build  _source  _static  _templates  conf.py  index.rst  make.bat  ...
# git config --global --add safe.directory /docs
# git branch
  ...