Blog atrasado con gajes del oficio

Setup Remote and Master Branches Before Updating Hugo

A while ago, I had to set remote and master branches on a different machine.

The methods included setting it up through the git pull command. By going tis route, both the master and remote branches were consequently set and configured without a major inconvenience.

Recently, although I tried to replicate the same method above, I faced problems that included among many other errors, the infamous error: src refspec master does not match any. error: failed to push some refs to 'origin

I wasn’t going to go through the poor method of setting up a new site and copy-paste among other files, the posts folder, the theme, the config files, and any other modification I had previously committed.

The site was being generated without a mishap, so I knew it had to do with the no less complicated git, since some of the errors, like the above, were clearly describing that origin did not match the one from the remote.

the necessary steps are as follow:

1-Remove with git all leftovers from the public folder with git rm -rf public

2-Remove the public folder itself with rm -rf.

3-Add the static site as a submodule to the master with git submodule add -b master <git@github.com:<USERNAME>/<USERNAME>.github.io.git public>.

And that should be more than enough to have it working in no time. Push your changes and update it accordingly.