Github Pages - Which Files should get pushed to repository?

I have a Jekyll site that uses the default Minima Theme. I’m still very new to Jekyll, so I have a rather basic question –

Which files out of the files in my Jekyll site folder should the Github Pages repository actually contain?

Right now, when I hit ls -al inside my main jekyll site directory / git cloned directory, I get the following:

.git
.gitignore
.sass-cache
404.html
Gemfile
Gemfile.lock
_config.yml
_posts
_site
about.md

and so on. This is the directory where I hit jekyll build etc.

The contents of the .gitignore file are:

_site
_.sass-cache
======
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata

If I go over to my git repository, I see (predictably) all the files in my local git directory that are not .gitignore 'ed. You can see my repository to confirm that it contains most of what I have referred to above - the Gemfile, Gemfile.lock, _config.yml and so on.

I’ve read elsewhere that the pages that actually make up your site are those html pages that Jekyll puts in the _site folder. So am I doing this wrong, and should I somehow only be pushing the contents of _site into my Github Pages repository?

Or is this all working the way it’s supposed to be working?

I’ve noticed that there is a noticeable (few minutes) delay between pushing changes to my repository and seeing the ensuing changes at the URL for my website. Is this normal? Is Github running Jekyll serve on their own server?

GH runs jekyll in the background, so ideally you just push what you are currently pushing and let GH regenerate it. Sometimes it is super quick other times it seems to take a minute or two.

That is the easiest way to do it.

Some people have dependencies that GH does not support, in that case you have to build locally and then you can push the _site folder to GH or somewhere else as needed - in this case the _site folder is a fully functioning website and can be hosted just about anywhere.

1 Like