Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save simbo/e16004d836a1dcf694d1 to your computer and use it in GitHub Desktop.
Save simbo/e16004d836a1dcf694d1 to your computer and use it in GitHub Desktop.
Use GitHub project subfolder as GitHub pages project page

Create an empty branch for your github page:

git checkout --orphan gh-pages

Commit at least one file to this branch and push it to GitHub.

Switch to your master branch.

Choose a subfolder name to link to your gh-pages branch, i.e. www.

Add your gh-pages branch as subtree:

git subtree add --prefix=www origin gh-pages

Now, after committing changes within www, run this command to sync your gh-pages branch:

git subtree push --prefix=www origin gh-pages

Browse to your instantly released site at <user>.github.io/<project>.

Have phun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment