Error building a site in hugo (.gitmodules)

Since first building the hugo website in Netlify I have been having persistent build fails.
Site name: https://martin-blog.netlify.app

PLEASE help us help you by writing a good post!

Log:
8:36:06 PM: Build ready to start

8:36:08 PM: build-image version: 9d79ad851d6eff3969322d6e5b1df3d597650c41

8:36:08 PM: build-image tag: v3.3.19

8:36:08 PM: buildbot version: 2cc7ea668a3e8f63326d15aab17e62cd1997fa2e

8:36:08 PM: Fetching cached dependencies

8:36:08 PM: Starting to download cache of 72.7MB

8:36:10 PM: Finished downloading cache in 1.968322099s

8:36:10 PM: Starting to extract cache

8:36:13 PM: Finished extracting cache in 2.892485236s

8:36:13 PM: Finished fetching cache in 4.889611816s

8:36:13 PM: Starting to prepare the repo for build

8:36:14 PM: Preparing Git Reference refs/heads/master

8:36:18 PM: Error checking out submodules: fatal: No url found for submodule path ā€˜themes/mainroad’ in .gitmodules

8:36:18 PM: Failing build: Failed to prepare repo

8:36:18 PM: Failed during stage ā€˜preparing repo’: Error checking out submodules: fatal: No url found for submodule path ā€˜themes/mainroad’ in .gitmodules
: exit status 128

8:36:18 PM: Finished processing build request in 9.863745883s

Not sure why .gitmodules is required and why isn’t it added automatically however tried adding it under the theme folder and still wouldn’t work. Used this as reference: Git - gitmodules Documentation

[submodule ā€œthemes/mainroadā€]
path = themes/mainroad
url = git://github.com/vimux/mainroad

Hi, @mcdragon, I do see successful builds today. Did you resolve the issue? If so, we’d love to learn what solution worked for you?

The usual root cause and solution for this are covered in this support guide:

The repo listed in .gitmodules above is a public repo. In many cases, it will be a requirement to change the URL into a https:// prefixed URL instead of the git:// prefix.

​Please let us know if it there are any unresolved issues or questions and we’ll do our best to answer.

Thank you Luke

I think I did create a submodule but I still couldn’t find what the problem was.
So I backtracked and reinstalled the theme but this time cloned it from the original project and then created a submodule.
However the theme changes still won’t end up on the hugo site on Netlify.

Martin

OK, sounds like you didn’t actually get things created or configured correctly, then :slight_smile: Could you share your .gitmodules file, as well as a link to your recent build logs with it in place, in our UI?

That will help us narrow things down a bit more, hopefully!

Here it is
[submodule ā€œthemes/mainroadā€]
path = themes/mainroad
url = GitHub - mcdragonsi/Mainroad: Responsive, simple, clean and content-focused Hugo theme based on the MH Magazine lite WordPress theme

Hello @mcdragon

I had a similar issue a few weeks ago. Not sure if this will help. But, I had to go into the .git directory and open up the config file that was there. I noticed that though i had a ā€œsubmoduleā€ with name ā€œXā€ in the .gitmodules file, i also had a reference of the same name in the .git --> config file. It was a difference purpose, I forget what it was. I removed that reference (as well as a few other bad references i had somehow created), and things worked perfectly for me.

Hopefully that might help you.

ps - you won’t find ALL of these config settings in a GUI, so only the file.

1 Like