Skip to content

Command "git rev-parse --show-toplevel" failed in v0.9.3 #104

@jmrtnz94

Description

@jmrtnz94

The most recent version v0.9.3 has introduced a build error.

This error goes away after setting the plugin to v0.9.2.

.gitlab-ci.yml

build-docs:
  stage: build
  script:
    - mkdocs build --clean
    - echo "MkDocs site built successfully"
  artifacts:
    paths:
    - site/
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'

GitLab Runner Error

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/mkdocs_git_authors_plugin/git/command.py", line 69, in run
    p.check_returncode()
  File "/usr/local/lib/python3.11/subprocess.py", line 502, in check_returncode
    raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command '['git', 'rev-parse', '--show-toplevel']' returned non-zero exit status 128.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mkdocs/__main__.py", line 288, in build_command
    build.build(cfg, dirty=not clean)
  File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/build.py", line 265, in build
    config = config.plugins.on_config(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mkdocs/plugins.py", line 587, in on_config
    return self.run_event('config', config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mkdocs/plugins.py", line 566, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mkdocs_git_authors_plugin/plugin.py", line 63, in on_config
    self._repo = Repo()
                 ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mkdocs_git_authors_plugin/git/repo.py", line 13, in __init__
    self._root = self.find_repo_root()
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mkdocs_git_authors_plugin/git/repo.py", line 95, in find_repo_root
    cmd.run()
  File "/usr/local/lib/python3.11/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions