Liquid Exception: No such file or directory - git rev-parse HEAD in /_layouts/default.html

While trying to change my jekyll theme file by following this guide: https://jekyllrb.com/docs/themes/ I get this error when trying to run bundle exec jekyll serve

bundle exec jekyll serve
Configuration file: C:/womensportcamp.com/_config.yml
            Source: C:/womensportcamp.com
       Destination: C:/womensportcamp.com/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
     Build Warning: Layout 'post' requested in _posts/2017-09-22-health-benefits-of-yoga.markdown does not exist.
     Build Warning: Layout 'post' requested in _posts/2017-09-23-how-to-maintain-a-healthy-heart.markdown does not exist.
  Liquid Exception: No such file or directory - git rev-parse HEAD in /_layouts/default.html
jekyll 3.5.2 | Error:  No such file or directory - git rev-parse HEAD

Looks like a path issue… perhaps something in your Gemfile or config file…
How are you accessing your theme…?

Not sure I understand what you mean … I am using the command prompt with Ruby and used bundle install to install my theme.

Please tell me exactly what I should look for so I can make myself understood

not sure if this is it, but did you check those 2 files listed? see if there is a git message in there. I think that if there is a git conflict it will leave a message around the offending area and maybe jekyll is choking on that.

What exactly should I check about those 2 files? I’ve created those while I had the default minima theme installed and all went smooth - the website was running great and I was able to create new posts and edit some configurations. All those issues showed up when I tried to change the theme.

Please treat me as a complete noob in regards to this ruby/gem/git thing and tell me where should I look for this message.

my thought is that you did a git merge of some sort, git had a conflict, and it left a message in one of those files that starts or contains that text, jekyll is seeing it and is saying hey wait - there is no such file called git rev-parse whatever.

just open those files and read them and see if there is something in there probably at the top in the front matter that has that text.

If there is nothing like that in those files try searching the whole repo if you are using sublime do a find in files for git rev-parse and see if it is in a file somewhere.

I’m not saying that this is it, just worth checking. I am no git expert but I think I screwed up once and ended up with something like this.

it could also be in a layout file if you are using nested layouts I think.

Is there a public repo to look at?

Ahh… now I too think this could actually be the issue… :+1:

@jekyllfreak, Like @rdyar mentioned, you should probably search through all of the files in your project directory, specifically looking for git rev-parse HEAD or at the least HEAD

If your project directory contains a huge number of files, I suggest using an advanced text-editor such as SublimeText or Notepad++ to search through a bunch of files easily…
Also, if you’ve the project repository on GitHub then you can do the search there as well…

Thank you for your responses.

I have done a full infile search using Total Commander and searched both my jekyll directory (c:\womensportcamp.com) and the theme gem file location c:\Ruby24-x64\lib\ruby\gems\2.4.0\gems\jekyll-theme-primer-0.5.2\ for strings such as git rev-parse or “rev-parse” and couldn’t find anything. Just to make sure, opened those 2017-09-22-health-benefits-of-yoga.markdown and 2017-09-23-how-to-maintain-a-healthy-heart.markdown manually and everything seems to be ok.

I am ready to pack up the whole directory and attach it here if you think it will make any difference

Unfortunately the project it’s not on github as it’s hosted on aws amazon

Do you have a layout called post? that is the first error.

I would make a new jekyll site and see if it does the same thing. If not then I would start simplifying your project until you can get it to work.

I’d also try a different theme or no theme. Since the theme is sort of hidden, maybe it is not using the theme you think it is or something?

Are you using plugins? anything custom?

I’d also try running with verbose - maybe it will give you more info.

I don’t use themes so I can;t help on that front.

For me, this was caused by git not being on the PATH. Try adding your git bin folder (the one containing git.exe) to the PATH environment variable.

Thank you! This solved my problem, too