部署Jekyll到Github页面 [英] Deploying Jekyll to Github Pages

查看:110
本文介绍了部署Jekyll到Github页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Jekyll本地建立了一个网站,并将它推到了一个新的主要回购站点(username.github.com),该站点工作得很好。我的问题是,如何将 可部署部分_ _ em> site 目录移动到gh页面分支中?或者说,如果这是最好的部署方式,该目录的内容?



我打算使用自定义域名。我的工作流程将在主分支中工作,也许一些功能分支,然后将编译结果推送(合并)到gh页面分支。这听起来正确吗?




解决方案

如果您已将基于Jekyll的网站推送到某个网站,则工作流程听起来并不正确。 username.github.io repository,那么你不需要 gh-pages 分支。一个 gh-pages 分支只需要您想要在同一个存储库中拥有代码和网站的存储库。 GitHub Pages将负责为您运行Jekyll并为这两种情况下的编译网站提供服务。



GitHub Pages确实以特定的方式运行Jekyll以确保其安全。如果您在Jekyll站点上使用自定义插件,那么您需要将编译的站点(您提到的 _site 目录)存储在master分支上,并且源代码总而言之,您的工作流程应该在您的本地存储库中工作 - 无论是在 master> 分支或功能分支(根据需要将功能分支合并到本地 master 分支) - 当您准备发布时,将本地存储库推送到 master 在GitHub上分支。


I have built a site locally with Jekyll, and have pushed it to a new master repo (username.github.com) and the site works great yay. My question is, how do I move just the deployable part, the _site directory, into a gh-pages branch? Or rather, the contents of that directory if that is the best way to deploy?

I plan on using a custom domain. My workflow will be to work in the master branch, maybe some feature branches, and then push (merge) the compiled outcome into the gh-pages branch. Does that sound correct?

I am having a tough time figuring it out via documentation, would appreciate any help, thank you!

解决方案

Your workflow does not sound correct based on the details in your question.

If you have pushed your Jekyll-based site to a username.github.io repository, then you do not need a gh-pages branch. A gh-pages branch is only required for repositories where you want to have code and a website in the same repository. GitHub Pages will take care of running Jekyll for you and serving the compiled site in both cases.

GitHub Pages does run Jekyll in a very specific manner in order to keep it safe. If you're using custom plugins with your Jekyll site, then you'll need to store your compiled site (the _site directory you mentioned) on the master branch, and the source in a different branch.

To summarize, your workflow should be work in your local repository - either in the master branch or feature branches (merging the feature branches to your local master branch as needed) - and when you're ready to publish, push your local repository to the master branch on GitHub.

这篇关于部署Jekyll到Github页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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