Deploy hugo from source repo to public repo

Hello,
I have a source repo containing the markdown files, and a public repo which is my user repo mostafatouny/mostafatouny.github.io. I am trying to setup a github workflow so that my source repo successfully builds and pushes into my user repo.
I saw this and it had successfully deployed on mostafatouny.github.io/start-blog as expected. I don’t know how to modify it. I found some online workflows scripts but they seem all outdated and caused build errors.
I prefer to push into public repo using personal access key rather than public-private SSH keys.

Thank you in advance

Why do you need two different GitHub repositories?

I don’t need two different repos. I only want to push to my user repo mostafatouny/mostafatouny.github.io so that my website is live on mostafatouny.github.io. I am not aware of any other method to achieve that.

There may be a language barrier here, or a conceptual misunderstanding.

Typically the “source” repository is the GitHub repository, and anything you might have locally is just a clone.

This is what a typical Hugo project looks like on GitHub. There typically isn’t a “public” directory because GitHub does the building, not you.

https://github.com/jmooring/hosting-github-pages

I agree and saw that in the doc.

The problem is I don’t get how to let github deploy on mostafatouny.github.io url rather than mostafatouny.github.io/starter-blog url.

OK, I just created an example of a personal pages site:
https://github.com/jmooring/jmooring.github.io

The live site is here:
https://jmooring.github.io/

It worked!

In Github’s documentation they have Configuring a publishing source for your GitHub Pages site, which mislead me to have two repos.

Also the web is polluted with many misleading tutorials like this one.

It might be a good idea to mention in Hugo’s doc, Host on Github Page that the same workflow script works for project, user, or organization repos.

Please accept my apology for the bad question. Let me know if I can contribute back in any way.

https://gohugo.io/hosting-and-deployment/hosting-on-github/#types-of-sites

It might be more clarifying to mention: that github workflow script deploys the website to the base url configured in configure.yaml, which is supposed to be

  • https://<username>.github.io/<repo> if project repo <username>/<repo>.
  • https://<username>.github.io if user repo <username>/<username>.github.io.
  • https://<organization>.github.io if organization repo <organization>/<organization>.github.io.

Sorry if it sounds naive.

No, it doesn’t.

https://github.com/jmooring/jmooring.github.io/blob/main/.github/workflows/hugo.yaml#L62C8-L62C61

With the GitHub Pages workflow the baseURL in your site configuration is irrelevant.

Thank you for your time, It is much appreciated. I believe it is my responsibility now to learn foundations.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.