Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to serve a "public" folder in github pages

Tags:

github

I have personal blog in github repo myname.github.io, i generates my site contents using Cabin site generator which generate build files in public folder. I wanted to serve the contents from public folder for Github pages. But it is always looking at the root folder.

Is there any option to tell Github to serve contents from public folder, not from root folder?

like image 499
Fizer Khan Avatar asked Sep 25 '14 14:09

Fizer Khan


People also ask

How do I host a folder in GitHub?

First, you need to sign-up for an account in GitHub, then you need to choose a plan that is suitable for hosting your project. There you will find a “New Repository” button, click that. This repository is like a folder in our computer. Now you need to Import Code, by clicking the button with the same title.

Can you run a server on GitHub Pages?

You can only deploy static sites on github pages. You can't deploy a server on github pages.

Does a GitHub Pages repo need to be public?

It is possible to use GitHub Pages with a private repository. GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.


1 Answers

  1. Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
  2. Make sure git knows about your subtree (the subfolder with your site). git add dist && git commit -m "Initial dist subtree commit"
  3. Use subtree push to send it to the gh-pages branch on GitHub. git subtree push --prefix dist origin gh-pages Source: https://gist.github.com/cobyism/4730490

  4. Go to the settings of the project and set the gh-pages as the branch for the website

like image 111
Reni Avatar answered Sep 28 '22 00:09

Reni