Error: command error: unknown command "sh" for "hugo"

Pipeline failing

  • Recently hugo site deploy has been failing
  • I have tried with fedora hugo docker image as well, getting same error
  • No changes in .gitlab-ci.yml

Here is the partial log

hugo is the main command, used to build your Hugo site.
Hugo is a Fast and Flexible Static Site Generator
built with love by spf13 and friends in Go.
Complete documentation is available at https://gohugo.io/.
Error: command error: unknown command "sh" for "hugo"
Usage:
  hugo [flags]
  hugo [command]
Available Commands:

I have same problem:

Use “hugo [command] --help” for more information about a command.

Error: command error: unknown command “sh” for “hugo”

Cleaning up project directory and file based variables

ERROR: Job failed: exit code 1

I found a solution after multiple tries.

Adding an empty entrypoint fixes the issues.

image:
  name:  "....."
  entrypoint: [""]

Thanks, but where must I write these lines? My gitlab-ci.yml is in first part:

image: registry.gitlab.com/pages/hugo:latest

variables:
GIT_SUBMODULE_STRATEGY: recursive

stages:

  • build
  • deploy

buildProduction:
stage: build
script:
- hugo --minify
artifacts:
paths:
- public
only:
- master

change this part:

image: registry.gitlab.com/pages/hugo:latest

to

image:
  name: registry.gitlab.com/pages/hugo:latest
  entrypoint: [""]
1 Like

Thank you!

Had this happen too without having changed anything, I’m guessing the docker image entry point changed? I’m also pulling latest so that’s the only thing I can think of

I believe it is related to Docker version see For Docker 17.06 and later: in Run your CI/CD jobs in Docker containers | GitLab

1 Like

Change your gitlab-ci.yml first part like this:

image:
name: registry.gitlab.com/pages/hugo:latest
entrypoint: [“”]

variables:
GIT_SUBMODULE_STRATEGY: recursive

stages: