Two solutions :
You don’t use Jekyll plugins (or only those supported by github pages)
You build your site only if you need to test it locally (jekyll build
or jekyll serve
). The generated code (in _site
) will not be versioned as github pages will generate pages from the sources.
- Put _site to .gitignore
- Push you sources to github pages
You use Jekyll plugins
In this case, you need to build locally because Github pages cannot do the job with plugins.
- Jekyll build locally
- Put _site to .gitignore
- commit your sources in one branch
- commit your _site in another branch
See this post for more explanations.