Error in the first step of previewing or building the website

Hello, I'm following the blogdown book to build my first website and picked a theme (

However, when I try to Serve Site, I got this error:

> blogdown:::serve_site()
Launching the server via the command:
  /Users/liuxiaochi/Library/Application Support/Hugo/0.80.0/hugo server --bind -p 3467 --themesDir themes -t uBlogger -D -F --navigateToChanged
Error: Error building site: logged 1 error(s)

And when I try to Build Website, I got this error:

==> rmarkdown::render_site(encoding = 'UTF-8')

Start building sites … 
ERROR 2021/02/06 09:11:30 Failed to read Git log: fatal: not a git repository (or any of the parent directories): .git
Total in 606 ms
Error: Error building site: logged 1 error(s)

This is annoying because other themes (such as the default one) just work fine.

Your kind guidance is much appreciated!


Can you try running the new check_site() function in order to help see if everything is configured as expected ? You'll need blogdown >= 1.0

Also, you can set the option blogdown.server.verbose = TRUE before running the server (or set it in your .Rprofile. This will allow to see some more verbose Hugo output. It seems the error you get is from Hugo command.

The two things above will require to update blogdown to at least 1.1 - I hope you can to that.

Hope it helps

Thank you very much @cderv.

blogdown::check_site() is such a powerful tool. I followed its instruction to modify the relevant files, then the problems are gone.

1 Like

We are very happy to hear that! Glad it works well for you ! Thank you !

I'm very curious about what the problem was. The error message Failed to read Git log sounds unfamiliar to me, and I wonder how blogdown::check_site() helped you resolve the problem.

Hello @yihui.

After I created a new project in RStudio with the theme, I directly used the addin Serve Site to preview the site, then got the error Failed to read Git log.

The check_site tool prompted me to initiate a git. After doing that, the site can be previewed and built, although I don't know why the step of "turning the project into a git version one" is a must for this theme.

I see. My guess is that the theme used variables like .GitInfo, but my quick search in the repo didn't find it. Anyway, I'm glad that check_site() helped, although it might have helped just by accident :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.