Comments (11)
Thanks so much for the help. I did find a work around. I moved the Dockerfile
and mkdocs.yml
up to the root of the git repo. Then I attached the docker volume to the git repo root also, but changed the mkdocs.yml
to reflect the new docs_dir
structure and the location of the theme with custom_dir
. Hoping there's no unintended side effects but all seems to be working now.
from mkdocs-git-revision-date-localized-plugin.
Going to need a bit more info.
You cloned a repo, cd-ed into it, and running mkdocs serve gives you this error?
What OS are you on? Which version of python? Running the latest mkdocs package and of this package?
from mkdocs-git-revision-date-localized-plugin.
Also, is there a larger traceback you can paste ?
from mkdocs-git-revision-date-localized-plugin.
Thanks ...
Here's the full traceback
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/mkdocs/__main__.py", line 177, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 54, in serve
config = builder()
File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 49, in builder
build(config, live_server=live_server, dirty=dirty)
File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 257, in build
config = config['plugins'].run_event('config', config)
File "/usr/local/lib/python3.9/site-packages/mkdocs/plugins.py", line 102, in run_event
result = method(item, **kwargs)
File "/usr/local/lib/python3.9/site-packages/mkdocs_git_revision_date_localized_plugin/plugin.py", line 65, in on_config
self.last_site_revision_timestamp = self.util.get_git_commit_timestamp(
File "/usr/local/lib/python3.9/site-packages/mkdocs_git_revision_date_localized_plugin/util.py", line 135, in get_git_commit_timestamp
raise err
File "/usr/local/lib/python3.9/site-packages/mkdocs_git_revision_date_localized_plugin/util.py", line 106, in get_git_commit_timestamp
git = self._get_repo(realpath)
File "/usr/local/lib/python3.9/site-packages/mkdocs_git_revision_date_localized_plugin/util.py", line 40, in _get_repo
self.repo_cache[path] = Repo(path, search_parent_directories=True).git
File "/usr/local/lib/python3.9/site-packages/git/repo/base.py", line 224, in __init__
self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
File "/usr/local/lib/python3.9/site-packages/git/repo/base.py", line 307, in common_dir
raise InvalidGitRepositoryError()
git.exc.InvalidGitRepositoryError
Running mkdocs-material
using the squidfunk/mkdocs-material
docker image.
Using plugins so running with the following Dockerfile
FROM squidfunk/mkdocs-material
WORKDIR /tmp
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
WORKDIR /docs
requirements.txt is
mkdocs-material
mkdocs-enumerate-headings-plugin
mkdocs-git-revision-date-localized-plugin
mkdocs-mermaid2-plugin
mkdocs-techdocs-core
I think I might know what's going on here but don't know how to address ... The directory in which I'm currently docker run --rm -it -p 8000:8000 -v ${PWD}:/docs myImage
isn't the root of the git repository, so it looks like inside the container there's no knowledge of the .git
hidden folder which exists one level up.
from mkdocs-git-revision-date-localized-plugin.
@aforsythe If the .git
directory is not mounted into the container, that's likely a problem. Why not mount the parent folder (likely your entire repo) into /docs
instead? That is what we do anyway.
from mkdocs-git-revision-date-localized-plugin.
Indeed that seems to be the problem. The official mkdocs-material docker image states:
Mount the folder where your mkdocs.yml resides as a volume into /docs:
Start development server on http://localhost:8000
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
Is mkdocs.yml
in the root of your repository, same as where your .git
folder is? Alternatively, is there a .dockerignore
file in your project that ignores the .git
folder?
from mkdocs-git-revision-date-localized-plugin.
No .dockerignore
...
The Dockerfile
and the mkdocs.yml
are in the subdirectory of the repo. That's what is getting mounted as a docker volume, so the container isn't seeing the .git
directory that's one level up. I tried moving the Dockerfile
up, mounting the top level directory, but then mkdocs
doesn't build with the squidfunk/mkdocs-material
docker image because it assumes the mkdocs.yml is in the directory that gets mounted to /docs
in the container.
Sorry this obviously isn't an issue with your plugin, but if you've got thoughts on how to manage the issue in an elegant fashion, I'd love your input. I can brute force it by copying the contents of the mkdocs-material
Dockerfile
into my Dockerfile
and modifying the working directory, but I'm hoping there's a more elegant solution.
from mkdocs-git-revision-date-localized-plugin.
@aforsythe Not sure if this can help, but I came across https://github.com/backstage/mkdocs-monorepo-plugin while looking through https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins. Maybe this, or another similar plugin, can support your use case as well.
from mkdocs-git-revision-date-localized-plugin.
@squidfunk any possibility we can improve the mkdocs-material
docker image for better compatibility / easier setup with plugins that use git ? Reading the thread above it seems we might be able to make things easier :)
from mkdocs-git-revision-date-localized-plugin.
Certainly any way to make it a little clearer how to deal with this sort of situation, would be appreciated. I'm coming to mkdocs
and mkdocs-material
pretty green, so there's some stuff that was pretty obvious that I just messed up along the way. This felt like it required a bit of digging to get right.
from mkdocs-git-revision-date-localized-plugin.
@timvink the getting started guide assumes that mkdocs.yml
and the .git
folder are on the same level, yes. If you deviate from that path, i.e. mount a subfolder, YMMV. I don't want to make the getting started guide any more complicated, but we can certainly add a note to the setup page of your plugin. If you feel that this is a good idea, a PR is appreciated.
from mkdocs-git-revision-date-localized-plugin.
Related Issues (20)
- Unable to set any configurations HOT 12
- Typo in variable names HOT 2
- The plugin breaks with the last mkdocs docker image HOT 3
- The plugin breaks with squidfunk/mkdocs-material:9.0.3 HOT 1
- Is there a way to turn off warnings? HOT 4
- Improve error message for dubious git ownership HOT 2
- if a file has no git logs, use the last modified timestamp instead of the current HOT 4
- which themes will this plugin work?
- Feature request: exclude specific commits when calculating the 'last update' calculation HOT 3
- Poor performance on large monorepos HOT 3
- Timeago setting results in incorrect items being added to extra_javascript HOT 2
- Create date not correct on Github pages HOT 4
- Document how to use sparse checkouts
- correctly populate `lastmod` of `sitemap.xml` HOT 2
- DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version HOT 1
- Cloudflare Pages fetch-depth HOT 6
- 1.2.3 breaks integration with Material for MkDocs HOT 5
- Whitelist / Negate certain excludes with a `!`? HOT 1
- Feature Request: Show datetime on hover when using timeago
- DeprecationWarning when using Mldocs Material 9.5.20 and Mkdocs 1.60 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs-git-revision-date-localized-plugin.