Problem getting started with Hugo on Windows via Git bash

Running Windows 8.1 64bit, I have installed “Git for Windows”.

I have created a new folder in the root of the C drive called “command-line” and placed hugo.exe (v .12) in that folder.

I have added that command-line folder to Windows system PATH environment variable.

In Git bash I can run hugo.exe but I’m have the exact problem as this person:

“I am having a similar problem in windows 8.1 64 bit
after creating a new project with hugo new site /path/to/.site
cd to new site path
run hugo new
it gives the following error messaage
$ hugo new
ERROR: 2014/06/27 Config not found… using only defaults, stuff may not work
D:\hugo\content\ created”

Hugo created a new content folder and file in my /c/command-line folder, not in the site directory.

I tried placing hugo.exe in the c/program files(x86)/git/bin folder and I can reach hugo (this time without the .exe extension- yey) but it still does not see the config file when I have cd into the sites folder.

The link above says the issue is fixed so is there something I’m missing?

Thanks for reading.

@David_Smith, I don’t think v.12 works properly in Windows; please use tip.

Since v.12 there have been some fixes so that Hugo will run on Windows. There are still some problems and inconsistencies on Windows, which a check of the Hugo issue queue on github and here will show.

Hugo will have first-class support for Windows soon but we aren’t there yet.

Any additional issue reports and any help that you or any other Windows users can provide is greatly appreciated. Contributions from users who use Windows as their main environment would be greatly appreciated.

My experience is the opposite. 0.12 works in Windows, but tip breaks compatibility. There’s an open issue in GitHub tracking it down.

It depends on how you run Hugo, iirc. Hugo doesn’t place content correctly or discover the location of the config file properly unless you are running Hugo in the site directory. On Windows, Hugo v0.12 and prior will always return the application executable’s directory as the working directory, instead of the actual working directory.

Running Hugo v0.12 within the site directory probably results in proper behavior, to a point.

There were patches applied to Viper and tip to resolve the location of config file and proper discovery of the Working Directory. This resulted in the reported issues being closed, which is probably why you didn’t see them in Hugo’s Github issue queue.

However, that being said, you are right there are issues with Hugo on Windows in tip. This includes permission issues on site generation, which is what I think you were referring to @DerekPerkins. There is also an issue with the path-separation characters in the URL path due to conflation of file path and url path handling in the code base.

That being said, I defer to @DerekPerkins, in terms of which works best in Windows as I my work on Hugo in Windows is only related to trying to get Hugo to work as expected on Windows; I do not use it for site development or development. As such, I’m sure @DerekPerkins has more experience with Hugo on Windows than I do.

Also @David_Smith, along with any other Windows users, please report any other issues you discover with Hugo on Windows.

@David_Smith What is your site config file named?

@DerekPerkins Sorry for the delayed reply but after reading the first answer I spent some time refurbishing an old laptop and installing Lubuntu. (Lots to learn here.)

As for my Windows setup, and in answer to your question, the config file is named config.yaml.

I’m using Hugo on windows and its working just fine. However, it does require using the “Open command window here” command from the context menu in the working directory. If I open the command window somewhere else and then navigate to the working directory the same problems occur as with Git bash. There is no difference between Hugo 0.12 and 0.13 in this regard.

I haven’t been able to get Git bash or the Powershell to work with either the current or Dev versions of Hugo.

@paulsullivan I don’t have the “Open command window here” in my context menu. Is that the Windows command line you are using?

if you hold down the shift key then right click on the working folder you should see “Open command window here” in the context menu. It is the Windows command line.

Thanks Paul, I just found that and tried it out. Hugo seems to be working using this method.

So do you manage to just work in the Windows command window for Git too?

Sorry, I’m not using Git with Hugo sites at the moment. That is the next phase now I have Hugo working locally.