Problem with 'enableGitInfo' on Pages

On a site hosted with Gitlab Pages, if I activate enableGitInfo, the Gitlab CI/CD generate an error, and the site is not deployed…

Error message in the pipeline output:

Building sites … ERROR 2019/08/19 05:08:23 Failed to read Git log: Git executable not found in $PATH
Total in 114 ms
Error: Error building site: logged 1 error(s)
ERROR: Job failed: exit code 255

Found nothing about similar problem on this forum.

Hugo version: v0.55.6-A5D4C82D
Git Repo:

Here’s your issue. Add this command to your build script to do a sanity check

command -v git && \
echo "git is on PATH" || \
echo "git is not on PATH"

Thank you.

I will look where to put this on Gitlab build script.

The strange thing is that, when I remove enableGitInfo there is no error message

Well that makes sense: the build script, for whatever reason, isn’t finding git in the path. But hugo doesn’t require git unless it is doing a git thing, like checking GitInfo.

I’m not sure what is included in the image at, but it looks like it’s about ~15MB, which I don’t think includes git. When I used a (self-hosted) GitLab CI build, I loaded a base Alpine image, and then installed git, hugo, etc.

On the other hand, you might be able to search and find Hugo deployment scripts similar to yours. :slight_smile:

1 Like

Thanks @maiki

I will look at this… your post give me some light on the process of this error. It’s a begining.

As I’m not an expert with Gitlab, I have to RTFM about how builds work. And search a script.

The Hugo images provided by Gitlab do NOT come with Git. Why I’m not sure.

If you switch to the image recommended by the Hugo documentation, it’ll work:

# .gitlab-ci.yml
image: monachus/hugo

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