Unable to override `theme` config variable using build command

I have a config file which includes the following:

theme = "dream-plus"
themesDir = "../.."

Now, since I am setting up Netlify as a CMS, it normally clones the given repo as repo so I initially tried passing the build command as:

hugo server --theme repo

This failed badly, I don’t think this overrode the config variable perfectly and what I get I a useless successful build which renders nothing.
I reproduced this locally and am sure that it due to a conflict between config theme variable and the one passed in the build command. Is there any solution for it. I want to refrain from creating a new config file.

you are right, override does not work!
remove the theme from the config file.

With the next version we will get a way to do this with an “Environment” option.

1 Like

Any updates regarding this?

See https://github.com/gohugoio/hugo/issues/5569

Please see also https://github.com/gohugoio/hugo/issues/5061 for a workaround that we have been using for Hugo’s Themes website, as in using the environment variable HUGO_THEME instead of -t command-line option.