Why put the _site-directory of a Jekyll site in .gitignore?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)