Skip to content

Instantly share code, notes, and snippets.

@timwco
Last active August 16, 2017 17:48
Show Gist options
  • Save timwco/fc07112fae7655a718fe to your computer and use it in GitHub Desktop.
Save timwco/fc07112fae7655a718fe to your computer and use it in GitHub Desktop.
Yeoman & Github Pages

By default Yeoman puts your final work in a folder called dist which by default is ignored by git.

Also, since the site is not powered from the root of your project, Github Pages will show a Page Not Found.

You need to both tell git to NOT ignore the dist folder as well as set up a subtree for your gh-pages branch.

Here are the steps.

Step 1

Remove the dist directory from the project’s .gitignore file.

Step 2

Make sure you add the dist folder.

git add dist

Then

git commit -m "Initial dist subtree commit"

Step 3

Use subtree push to send it to the gh-pages branch on GitHub.

git subtree push --prefix dist origin gh-pages

That's it, you should now be able to view your site on Github Pages

Future

One note... you'll need to run git subtree push... each time you want to push to your gh-pages branch.

git subtree push --prefix dist origin gh-pages

You can also read more here - http://yeoman.io/learning/deployment.html

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