将生成的 jekyll 发布到 gh-pages 并且不覆盖 _site 中的 .git
我正在使用 jekyll 直接在 Github 的 gh-pages 分支上发布静态站点。我遇到的问题是,每次运行
$ jekyll --no-auto /Users/khinester/Sites/tzm/
此命令都会覆盖 .git 目录,并且我必须重新创建此目录:
$ git init-db
$ git add remote ..
$ git add .
$ git commit -a -m 'message'
$ git branch gh-pages && git checkout gh-pages
etc..
$ git push -f github gh-pages
基本上我有包含生成博客所需文件的 master 分支和显示实际博客的 gh-pages 分支。
另请注意,我必须强行推动这一点。
如果还能够对更新进行版本控制,那就太好了!
我已阅读 https://github.com/mojombo/jekyll/wiki/Deployment 但这似乎比我现在所做的步骤更多。
有没有更好的方法来做到这一点或者我错过了什么。
I am using jekyll to publish a static site directly on gh-pages branch in Github. The issue I have is that every time I run
$ jekyll --no-auto /Users/khinester/Sites/tzm/
this overwrites the .git directory and I have to recreate this:
$ git init-db
$ git add remote ..
$ git add .
$ git commit -a -m 'message'
$ git branch gh-pages && git checkout gh-pages
etc..
$ git push -f github gh-pages
basically i have the master branch containing the files needed to generate the blog and gh-pages branch which displays the actual blog.
and also note that i have to force push this.
it will be nice to have also be able to version control the updates!
i have read the https://github.com/mojombo/jekyll/wiki/Deployment but this seems has more steps then what i do now.
is there a better way to do this or have i missing something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Jekyll 有一个名为
keep_files
的配置数组。当 Jekyll 重建站点时,该数组中的所有内容都将保留。这是添加的位置:https://github.com/mojombo/jekyll/pull/630。搜索
keep_files
的问题将揭示更多它的黑魔法。.git 和 .svn 文件默认添加到
keep_files
中,因此这不再是问题。Jekyll has a config array called
keep_files
. Everything in that array will be kept when Jekyll rebuilds the site.Here's where it was added: https://github.com/mojombo/jekyll/pull/630. Searching the issues for
keep_files
will reveal more of its black magic..git and .svn files are added to
keep_files
by default so this shouldn't be a problem anymore.我使用 Steven Penny 的脚本来编写这个脚本,该脚本是开箱即用的,适用于项目页面,而不是用户页面。
I used Steven Penny's script to write this one, which out of the box is for Project Pages, not User Pages.
我使用以下 shell 脚本来提交 Hakyll 生成的站点
(在目录
_site
中)到gh-pages
分支。脚本:master
或您所在的任何分支运行脚本。.git
目录,因为...它不在那里!gh-pages
分支,因此您不需要强制推。代码如下;根据需要更新路径
I use the following shell script for committing a Hakyll generated site
(in directory
_site
) to thegh-pages
branch. The script:master
or whatever branch you're on.the
.git
directory because... it isn't there!gh-pages
branch, so you don't need to force push.Code follows; update paths as necessary