New to Hugo/Git - Cloudfare build Fails

I am new to Hugo/Github all of it. But I have read the documentation and watched videos. I cannot for the life of me get a build to work. I have attached my Error Code and Github Repo below. I understand it says I am missing the “/content” folder, there is a similar topic addressing this. But i am wondering what I’m doing wrong in the process. Here is a summary of mine.

Make New Site > cd new site > add theme > copy only “theme config” to new site “config” > hugo server > (at this point i see my localhost and everything works and is how i want it) > hugo > cd public > git init > git status > git add . > git commit -m “test” > git remote add origin (mygithub) > git remote -M main > git push -u origin main > upload repo to cloudfare > ERROR.

Sorry for the weird formatting. Hopefully, someone can point me in the wrong direction, im sure it is just a lack of understanding on how to push Hugo to a repo.

The Error Repo should be under “server-testv9” GitHub - Diverse123/server-test9

09:59:34.887 Initializing build environment. This may take up to a few minutes to complete
10:01:59.123 Success: Finished initializing build environment
10:01:59.123 Cloning repository…
10:02:00.655 Success: Finished cloning repository files
10:02:00.816 Installing dependencies
10:02:00.818 Python version set to 2.7
10:02:01.893 v12.18.0 is already installed.
10:02:02.406 Now using node v12.18.0 (npm v6.14.4)
10:02:02.452 Started restoring cached build plugins
10:02:02.456 Finished restoring cached build plugins
10:02:02.585 Attempting ruby version 2.7.1, read from environment
10:02:03.624 Using ruby version 2.7.1
10:02:03.893 Using PHP version 5.6
10:02:03.926 5.2 is already installed.
10:02:03.932 Using Swift version 5.2
10:02:03.932 Installing Hugo 0.54.0
10:02:04.538 Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
10:02:04.539 Started restoring cached go cache
10:02:04.543 Finished restoring cached go cache
10:02:04.569 go version go1.14.4 linux/amd64
10:02:04.574 go version go1.14.4 linux/amd64
10:02:04.575 Installing missing commands
10:02:04.576 Verify run directory
10:02:04.576 Executing user command: hugo
10:02:04.610 Building sites … Total in 0 ms
10:02:04.610 Error: Error building site: open /opt/buildhome/repo/content: no such file or directory
10:02:04.613 Failed: build command exited with code: 255


  • one ` around inline code: `something` renders something
  • three ``` around block code samples ```something``` renders a code block

Me pointing you into the “wrong” direction, hehe:

  • your cloudflare process can’t find the folder content
  • i see /opt/buildhome/repo/content in there and think that build and home are two folders, not one, so maybe somewhere the configuration of your content folder says something along the lines of home/repo/content and should say /home/repo/content.

I tried looking for the configuration of my content folder. I could be blind, but any idea where that might be? GitHub - J-Siu/hugo-theme-sk1: Hugo Theme - SK1 (Skeleton 1)
This is the theme I am using, if i understand your comment correctly then the error should be in here?

No, the error is in your content folder. Which is not in that theme you linked. Where is your content? Without content, Hugo can’t do much.

I am confused. My “content” folder is empty, and when I pushed it to GitHub the “content” folder did not push (probably because its empty). However when i do “hugo server” I see my website just fine. There is a few lines of text, so im confused on why i need content when “hugo server” didnt need it to build.

I am confused as well. Is this the repository that you “upload” to Cloudflare?

Yes it is. That repo is my …Site/Public

Cloudflare is trying to build your site, which means it needs the whole project, not just the output from your local build.

Your GitHub repository should include everything: config, layouts, content, data, i18n, etc.

So could you point me in the folder that I should be making a repo of? It sounds like the site folder. So /Hugo/Sites/TestSite ?

I thought from reading and watching guides, the /public is what you push to repo.

Yeah, that one. Your repository structure should look something like this:

├── archetypes/
│   └──
├── content/
│   ├── post/
│   │   └──
│   └──
├── layouts/
│   └── _default/
│       ├── baseof.html
│       ├── home.html
│       ├── list.html
│       └── single.html
├── config.toml

… with the addition of the other directories that you might have (themes, i18n, data, etc.).


If I may ask a follow-up question. Since i was using it wrong what is the purpose of the “hugo” command and the whole /Public folder ?

With Cloudflare, you are using a CI/CD workflow. You push your project repository, it builds and deploys. In these workflows, we typically exclude the public directory from the repository via a .gitignore file.

But some sites use different workflows. For example, build locally, and push the contents of the public directory to an Apache/NGINX virtual host via rsync, ftp, etc.

Okay so i tried to push the whole site directory to repo… I am having errors again.

Here is my new repo which is from /hugo/sites/ag/

It has excluded alot of the folders, because i think it just pushes folders that have had a change and are not empty? But again, i can use “hugo server” and i see the website that i want to push to repo

Here is my terminal if that helps.

PS C:\hugo\sites\ag> git init
Initialized empty Git repository in C:/Hugo/Sites/ag/.git/
PS C:\hugo\sites\ag> git status
On branch master

No commits yet

Untracked files:
(use “git add …” to include in what will be committed)

nothing added to commit but untracked files present (use “git add” to track)
PS C:\hugo\sites\ag> git add .
warning: LF will be replaced by CRLF in archetypes/
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in config.toml.
The file will have its original line endings in your working directory
warning: adding embedded git repository: themes/sk1
hint: You’ve added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint: git submodule add themes/sk1
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint: git rm --cached themes/sk1
hint: See “git help submodule” for more information.
PS C:\hugo\sites\ag> git commit -m “first commit”
[master (root-commit) c858fd5] first commit
4 files changed, 14 insertions(+)
create mode 100644 .hugo_build.lock
create mode 100644 archetypes/
create mode 100644 config.toml
create mode 160000 themes/sk1
PS C:\hugo\sites\ag> git status
On branch master
nothing to commit, working tree clean
PS C:\hugo\sites\ag> git branch -M main
PS C:\hugo\sites\ag> git remote add origin GitHub - Diverse123/test-v12
PS C:\hugo\sites\ag> git branch -M main
PS C:\hugo\sites\ag> git push -u origin main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 12 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (7/7), 634 bytes | 634.00 KiB/s, done.
Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
To GitHub - Diverse123/test-v12

  • [new branch] main → main
    branch ‘main’ set up to track ‘origin/main’.
    PS C:\hugo\sites\ag>

Your repository has no content, and you have not added the theme properly.

You should be able to do this, and your site should build:

git clone --recurse-submodules
cd test-v12/

If you can’t do that, then Cloudflare won’t be able to either.

I added the theme in /hugo/sites/ag using the “git clone …” is that not the proper way to add?

My localhost looks like this :

Does that mean the localhost is using content from somewhere? Since my content folder is empty.

What command are using to run hugo server, and from which directory are you issuing the command?

“C:\Hugo\Sites\ag> hugo server”

‘ag’ is the main site dir

Not to put too sharp an edge on it, but at this point I have no idea what you have done.

It seems like you are trying to learn a lot of things, which is GREAT, but you’re trying to learn all of them at the same time, which is not.

I strongly encourage you to start over, from scratch, and follow the Quick Start instructions exactly as written, using the Ananke theme as described.

Note that you must have installed the extended version of Hugo.

@Diverse123 try this. Also, join Cloudflare Discord.

Hi @Diverse123,

I had same issue with my Hugo site which was failing on cloudflare only(same site was building property on netlify and on local) and the reason was Hugo module(for heroicons) but then another site failed. Cloudflare account manager told me they are working on some issues as it is a new service they offering and they are aware of long build times and fails and they bringing some changes so within few days we will see faster builds without regular fails.

So try to get rid of Hugo modules if that solves the issue hopefully.