Skip to content

InvalidGitRepositoryError during build when including auto-generated files #101

@Teagum

Description

@Teagum

I tried to use mkdocs-git-revision-date-localized-plugin together with [mkdocs-gen-files] to auto-generate references from Python doc strings. During the build, I encountered the following error message:

[git-revision-date-localized-plugin] Unable to find a git directory and/or git is not installed. To ignore this error, set option 'fallback_to_build_date: true',

followed by a git.exc.InvalidGitRepositoryError.

The fundamental problem is that mkdocs-gen-files stores its output in temporary files outside the project's repository. Hence, git-revision-date-localized cannot find a repository and produces the error.

On the other hand, it is possible to silence the error by setting fallback_to_build_date: true in mkdocs.yaml, such that the auto-generated pages are marked with the build date. This, however, turns the errors for each file into warnings, and thus it is impossible to use mkdocs in --strict mode.

Also, the exclude option does not work in this case since the names of the temporary files are unknown before build time.

I currently don't have a proper solution since it is obviously not straightforward to map auto-generated temporary files to the corresponding code files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions