发布Jekyll站点到Git仓库 [英] Publish Jekyll Site To Git Repository

查看:108
本文介绍了发布Jekyll站点到Git仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次运行Jekyll时,它都会破坏目标文件夹的全部内容。这个问题是我的目标目录是一个小的git仓库,我用它来推送到我的实际服务器。有没有办法阻止Jekyll删除Git文件,以便我不必生成内容,然后将它们复制过来? 解决方案

p>您可以在其他地方(即不在受Jekyll部署影响的目录中)


  • 您的git repo

  • 让您的脚本将该git repo推送到您的服务器中指定一个 GIT_WORK_TREE 变量,目标文件夹为值



换句话说,在工作树目录本身中不一定需要 .git

它可以在其他地方,脚本可以通过 GIT_WORK_TREE 或通过 - 工作树=<路径>来引用实际工作树; 选项。



如果您的脚本是Jenkyll复制/擦除文件的目标目录的一部分,则可以做相反的操作, .git 实际上与 GIT_DIR 变量或 - gi t-dir =< path> 选项。



要新建 - work-dir 作为你的仓库的默认选项,你可以使用 git-config --add core.worktree ../ PATH / ,其中 PATH - 实际工作目录相对于 .git 的路径。


Every time I run Jekyll it destroys the entire contents of the destination folder. The problem with this is that my destination directory is a small git repo from which I use to push to my actual server. Is there a way to stop Jekyll deleting the Git files so that I don't have to generate the contents then copy them over?

解决方案

You could have:

  • your git repo elsewhere (i.e. not in the directory affected by a Jekyll deployment)
  • have your script pushing that git repo to your server specify a GIT_WORK_TREE variable with the destination folder as value

In other words, a .git don't have to be necessary in the working tree directory itself.
It can be elsewhere, and your script can refer to the actual working tree through GIT_WORK_TREE or through a --work-tree=<path> option.

If your script is part of the destination directory where Jenkyll copies/erases files, you can do the opposite, and mention where the .git actually is with GIT_DIR variable or with --git-dir=<path> option.

To have new --work-dir as default options to your repo, you can use git-config --add core.worktree ../PATH/, where PATH - path to actual working directory relative to .git.

这篇关于发布Jekyll站点到Git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆