Search code examples
githubdeploymentbuildgulpgithub-pages

host github pages from /dist folder in master branch


I was trying to publish my -username-.github.io repository to github pages but my index.html is inside dist folder.

I cannot use git subtree push --prefix dist origin gh-pages because this is meant for project pages, not user/org pages.

All I want is, github to treat dist as root directory for hosting user/org page. Please help.Thanks

PS: I don't want to do redirection hack.


Solution

  • You can't do it this way.

    GitHub pages can be hosted from either:

    • the / folder in the master branch
    • the / folder in the gh-pages branch
    • the /docs folder in the master branch

    But the user pages must be built from the / folder in the master branch.

    TIP

    Code on another branch than the master. After every push to this branch, build it in any CI/CD tool and push it back to the master branch.