rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.43k stars 1.65k forks source link

How to prevent the .git directory in the output directory from being deleted? #2370

Closed phpmooc closed 6 months ago

phpmooc commented 6 months ago

Question

mdbook v0.4.37

As title described , if run the command like mdbook serve or mdbook build, I hope that the .git directory in the output directory should NOT be deleted, what should I do?

Any help will be appreciated.

Version

No response

ehuss commented 6 months ago

The output directory is intended to be ephemeral. You will need to send the output to another directory, and then use some tooling to either copy it into your repository or otherwise initialize it. There are some examples in the wiki, such as https://github.com/rust-lang/mdBook/wiki/Automated-Deployment%3A-GitHub-Pages-%28Deploy-from-branch%29, for doing deployment via git.

phpmooc commented 6 months ago

Tks a lot. but it seems so cumbersome and not what I expected, I found one workaround: have git in the parent directory.