Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs_dir not respected(?) #100

Closed
jeroendev-one opened this issue Feb 13, 2025 · 4 comments · Fixed by #103
Closed

docs_dir not respected(?) #100

jeroendev-one opened this issue Feb 13, 2025 · 4 comments · Fixed by #103

Comments

@jeroendev-one
Copy link

Hello,

I have my structure as following:

/usr/src (contains mkdocs.yml
/usr/src/documentation (contains git repo with markdown files)

The serve fails with the following error:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/mkdocs/livereload/__init__.py", line 211, in _build_loop
    self.builder()
    ~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs/commands/serve.py", line 67, in builder
    build(config, serve_url=None if is_clean else serve_url, dirty=is_dirty)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs/commands/build.py", line 265, in build
    config = config.plugins.on_config(config)
  File "/usr/local/lib/python3.13/site-packages/mkdocs/plugins.py", line 587, in on_config
    return self.run_event('config', config)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs/plugins.py", line 566, in run_event
    result = method(item, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/mkdocs_git_authors_plugin/plugin.py", line 60, in on_config
    self._repo = Repo()
                 ~~~~^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs_git_authors_plugin/git/repo.py", line 13, in __init__
    self._root = self.find_repo_root()
                 ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs_git_authors_plugin/git/repo.py", line 95, in find_repo_root
    cmd.run()
    ~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs_git_authors_plugin/git/command.py", line 79, in run
    raise GitCommandError("\n".join(msg))
mkdocs_git_authors_plugin.git.command.GitCommandError: GitCommand error:
Command "git rev-parse --show-toplevel" failed
Return code: 128
Output:

Error messages:
fatal: not a git repository (or any of the parent directories): .git

ERROR   -  [13:13:11] An error happened during the rebuild. The server will appear stuck until build errors are resolved.

It looks like it tries to execute the git rev-parse --show-toplevel in the /usr/src dir, and not in /usr/src/documentation, any idea how I can fix this?

Thank you in advance!

@timvink
Copy link
Owner

timvink commented Feb 22, 2025

Couple of ideas:

  • first the most obvious.. are you using git inside your project folder (usr/src)? As in, ran git init and make a first commit?
  • Can you try running git rev-parse --show-toplevel manually inside the documentation/ folder?
  • try using docs/ instead of documentation/ to store your markdown files, and see if that does work?
  • are you running mkdocs build command inside in the /usr/src directory?

@timvink
Copy link
Owner

timvink commented Mar 10, 2025

If you only use git inside /usr/src/documentation then I might be able to build a fix.

Can you have a look at the other questions?

@jeroendev-one
Copy link
Author

Hello,

Thank you for your responses!

The structure is as following:

root@mkdocs-59b6464657-knscw:/usr/src# ls -lha
total 4.0K
drwxr-xr-x. 1 root root   27 Mar  3 12:40 .
drwxr-xr-x. 1 root root   30 Feb 14 08:42 ..
drwxr-xr-x. 8 root root  132 Mar  6 07:55 documentation
-rw-rw-rw-. 1 root root 1.7K Feb 14 08:41 mkdocs.yml

The documentation folder is loaded and pulled using a bash script, this is all running inside a container. At first I thought it respected the docs_dir: documentation key, but I don't think it does that.

I use mkdocs serve inside the /usr/src folder, however the only folder containing git is the documentatin folder (docs_dir)

root@mkdocs-59b6464657-knscw:/usr/src/documentation# git rev-parse --show-toplevel
/usr/src/documentation

Thank you for your time taken!

@timvink
Copy link
Owner

timvink commented Mar 14, 2025

So the problem was supporting patterns where .git folder is inside doc_dir. Fixed in #103, released in https://github.com/timvink/mkdocs-git-authors-plugin/releases/tag/v0.9.3, should be on pypi shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants