Inadvertently Pushed a Hugo Theme as a Git Submodule

post-thumb
Table of Contents

I generated this website using the static site generator Hugo, and I am hosting it on GitLab. Following the instructions on this blog, I read a comment about not pushing your Hugo themes to GitLab as a Git submodule. Not thinking about it when it came time to push my local files to GitLab, I accidentally pushed my theme as a Git submodule.

Sure enough, that failed miserably. I don’t think all of the files were even committed properly since it failed importing my theme as a Git submodule. This trap is easy to fall into since the instructions for obtaining a new theme for Hugo is often to pull/clone it directly from the theme’s Git repository.

To remedy the problem, I did the following:

  1. Deleted my project from GitLab (it was easy for me to start over since I had just started a new project)
  2. Created a new project on GitLab
  3. Removed my local Git repository files from the main folder of my theme
  4. Recreated my local Git repository
  5. Added my files to the local Git repository
  6. Pushed the files to my re-created project on GitLab

After starting fresh and avoiding that pitfall, it all worked as it should!

comments powered by Disqus