Hugo

Hugo 101: Deployment

I have the same problems. does that mean I need to create a repository for the full hugo code, and another one for “public” code?

If I were you I would publish it as a Github project. Much easier to set up.

1 Like

Hi! I am facing the same issue as mentioned earlier:

$ git submodule add -f -b master https://github.com/<USERNAME>/<USERNAME>.github.io.git public
Reactivating local git directory for submodule 'public'.
fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it
Unable to checkout submodule 'public'

I tried from a completely blank folder too and had no success. Any help would be greatly appreciated…

What worked for me was to start the process all over again. I think it was something to do with the sub module file (that is a hidden git file) that have to be created again and won’t work if you try to create it if it is already there.

Thanks! I tried deleting .gitmodules and also redoing everything from scratch. Nothing works :frowning:

if you deleted .gitmodules you have to go inside the .git folder, then delete the modules folder in there too. then commit the changes on .gitmodules, then run git gc to cleanup and then restart. as long as the modules folder is there you can’t re-add these cleanly as submodules without being an expert ;). Also have a look inside of .git/config - there might be traces from those submodules too. It’s a git-repo inside of your git repo :wink:

A better way would probably be not to delete .submodules and just re-clone the repo into a different folder with git clone --recursive your-repo-path and then move everything changed from your old folder to the new one.

By the way: not sure why you call -b master in your first line. That should be the default and it always get’s the master branch (or the branch that is set as main branch in that git repository). That error message clearly states that the remove URL has no branch named master. try and see what happens if you leave it out.

1 Like

I had to remove a submodule to get me back on track.

I found the following advice the best out there:

https://davidwalsh.name/git-remove-submodule

I know this solution doesn’t fix your original problem, but have you tried using netlify for deploys and hosting? It has a great free plan and is super simple to set up using the Hugo deploy guide. Click Here to go to netlify