I tried embedding an image in one of my posts. It went well in hugo server mode. When I compiled the site with the hugo command:
Start building sites …
Total in 3287 ms
Error: Error copying static files: open
C:\path\to\myblog\public\static\the_image.png: Access is denied.
I am using the static/static trick described here. This works perfectly fine in hugo server mode, as my image shows up.
Yes, I have the extended version of Hugo installed. Yes, I tried the downgrading trick I did last time this happened. No, I cannot downgrade infinitely, since v0.79.0 is unsafe (and that’s an unsustainable bodge anyway). No, I cannot share the code repository.
How do I finally solve this issue? Like, a real solution.
I believe the problem has to do with Windows’ permissions/admin weirdness. But none of the googled answers work in my situation. They’re either solving a different version of the problem (like the permissions being on a server, rather than the desktop), or they suggest fixes that, themselves, don’t work (like changing a windows permission, which mysteriously undoes itself).
The access to create or write in the folder public is denied, NOT to the image. That means, that you have no folder public created AND Hugo is missing rights to create files in your directory. The quickest way is probably to create a folder named public and add a file .gitignore inside of that folder with the following content:
In the end:
Then add .gitignore to your repo and the problem will probably disappear. If not, then it’s the next level static folder that can’t be created.
For the folder rights on yourdirectory you might need to ask in a windows forum. Probably right click, settings, security and create rights (read/write) for the user that Hugo is running under. That might be your user, that might be another one if it’s somehow installed globally or linked from another user - we don’t know, because you don’t tell
It’s not, but it would have kept the public folder existing on a repository-based site. You need to get the file rights working on your station. Sometimes if you copy from one Windows computer to another the ownership on the new computer does not work, because although you might have the same name the ID of the user is different. So right click on the main folder (where the website is in) and check the tab security. Hugo needs to be able to create/write files recursively.
All users (including SYSTEM) that can be selected, already have all permissions on my site’s folder (the top-level one containing archetypes, content, data, layouts…). Except “special permissions”, which seems to just be more specific permission definitions anyway (so it wouldn’t need to be checked to give full perms).
Is Hugo some other “user” in the system? Typing “Hugo” into the add user thing didn’t work. How do I give Hugo the permissions it needs?