Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save both my _site and jekyll build on github

Tags:

github

jekyll

Right now i have the following setup:

My jeyll build is in ~/jekyll-sites

My .git folder is in ~/jekyll-sites/_site

I'm now able to sync the jekyll generated ~/jekyll-sites/_site with my repo at: https://github.com/nielsrasmus/nielsrasmus.github.io

and it works perfect.

But i would also like to to save the whole jekyll build on github.

The question is: Is it possible to make another repo called: nielsrasmus.github.io-source and sync the whole jekyll build here?

If so, what would be the best way to do it?

I've looked at so many answers that does not quite match what I want. So I'm pretty confused right now :-/

like image 995
Niller Avatar asked Jan 03 '14 22:01

Niller


2 Answers

As long as you're not using any Jekyll plugins, you can actually push your Jekyll source to Github, and their servers will automatically generate the _site folder and serve it for you. You won't see this _site directory show up in your repository, but the generated files will be accessible from http://nielsrasmus.github.io

A great reference for how to do this is Tom Preston-Warner's personal blog, which is (naturally) hosted on Github Pages. Note that he placed the _site directory in his .gitgnore file, and Jekyll says "it's probably a good idea" for you to do the same, but you might be able to skip this part.

Both you and Tom are using the User Pages option, so your site gets generated as long as your content is in the Master branch (if you were using Project pages, it would use the gh-pages branch instead).

like image 62
nicksuch Avatar answered Nov 26 '22 03:11

nicksuch


I think I solved the issue.

I installed the mac version of github and fiddled around, read a lot of man pages and finally I could make it happen :-)

This helped me

What helped me was to click on the + sign in the bottom of the screen, as shown on the screenshot. Here I could point my repos at a local dir.

nielsrasmus/jekyll-sites: points to the root of the jekyll build.
nielsrasmus/nielsrasmus.github.io: points to the generated site at ~/jekyll-sites/_site

like image 42
Niller Avatar answered Nov 26 '22 02:11

Niller