简体   繁体   English

如何告诉 Gitbook 在本地存储文件的位置?

[英]How to tell Gitbook where to store files locally?

I just want to create a simple gitbook on my local drive, not attached to any remote repository.我只想在我的本地驱动器上创建一个简单的 gitbook,而不是附加到任何远程存储库。 I went to File->Change Library Path... and pointed to the place where I want my files to go.我去了 File->Change Library Path... 并指向我想要我的文件去的地方。 When I create a new book, Gitbook puts some stuff in that library path that looks right: README.md, etc. But when I change README.md in Gitbook and save the file, it doesn't save to the README.md it created when I created the book.当我创建一本新书时,Gitbook 在该库路径中放置了一些看起来正确的内容:README.md 等。但是当我在 Gitbook 中更改 README.md 并保存文件时,它不会保存到 README.md 中在我创建这本书时创建的。 In fact I can't even figure out where it saved my changes, even after doing a find/grep on my entire hard drive.事实上,我什至无法弄清楚它在哪里保存了我的更改,即使在我的整个硬盘上进行了查找/grep。

Edit: I need to know where it saves, so I can run the command-line gitbook to create a pdf.编辑:我需要知道它保存在哪里,所以我可以运行命令行 gitbook 来创建一个 pdf。

Which OS are you using?您使用的是哪个操作系统? On Windows, the default directory is C:\\Users\\username\\GitBook在 Windows 上,默认目录是 C:\\Users\\username\\GitBook

I had troubles with this when I first started too.我刚开始的时候也遇到了这个问题。

Here is some background that may help you以下是一些可能对您有所帮助的背景

  • There are three flavors of gitbook: The online editor (storage is on Gitbook.com or Github), the offline editor (same storage + local at C:\\Users\\Documents\\Gitbook), and the CLI toolchain (any storage you desire). gitbook 有三种风格:在线编辑器(存储在 Gitbook.com 或 Github 上)、离线编辑器(相同存储+本地在 C:\\Users\\Documents\\Gitbook)和 CLI 工具链(您想要的任何存储) .
  • If you talking about issuing commands, you want to install the toolchain如果您谈论发出命令,您要安装工具链
  • If you are running Windows, I can't help, but when you switch to Ubuntu :) go to toolchain.gitbook.com to see the the instructions.如果您运行的是 Windows,我无能为力,但是当您切换到 Ubuntu 时 :) 转到 toolchain.gitbook.com 以查看说明。

Hope this helps希望这可以帮助

Yes, its weird that the changes are not immediately reflected in the physical file.是的,奇怪的是更改没有立即反映在物理文件中。 I changed something and saved again, that actually made the first save visible.我更改了一些内容并再次保存,这实际上使第一次保存可见。 :D Try it once, this may work for you too. :D 尝试一次,这也可能对您有用。

Gitbook Editor works with git history only. Gitbook 编辑器仅适用于 git 历史记录。 So externally edited and not committed files in that folder will not be identified in the editor.因此,该文件夹中外部编辑和未提交的文件将不会在编辑器中识别。 However, when you save the files in gitbook editor, it creates a commit and then only it will be reflected in the physical drive location.但是,当您在 gitbook 编辑器中保存文件时,它会创建一个提交,然后只有它会反映在物理驱动器位置。

You can find more about the issue here: https://github.com/GitbookIO/feedback/issues/101您可以在此处找到有关该问题的更多信息: https : //github.com/GitbookIO/feedback/issues/101

Currently there's no way to explicitly tell GitBook where to store files, however we use a simple workaround which allows us to use the GitBook Editor to edit a book in our own git repository but keep control of how and when we commit changes.目前没有办法明确告诉GitBook将文件存储在哪里,但是我们使用了一个简单的解决方法,它允许我们使用GitBook Editor在我们自己的git存储库中编辑一本书,但可以控制我们提交更改的方式和时间。

We have a docs directory in our project which contains the gitbook which is symlinked to the folder GitBook uses to store its own books.我们的项目中有一个docs目录,其中包含gitbook ,该目录符号symlinked到 GitBook 用于存储其自己的书籍的文件夹。 This directory has its own .git folder ignored from a parent directory as we don't need GitBooks commits.这个目录有自己的.git文件夹,从父目录中忽略,因为我们不需要 GitBooks 提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM