ngHeroes
  • πŸ‘€About
  • #0: πŸ’ƒ Introduction
  • #1: βŒ› Installations
  • #2: πŸ…° Angular kicks in
  • #3: πŸ“ Component
  • #4: ✏ A new component
  • #5: πŸ’Ό Class
  • #6: πŸ“₯ Property binding
  • #7: πŸ“€Event binding
  • #8: πŸ“Ž Element ref - #
  • #9: πŸ“‹ The To Do list
  • #10: βž• New component: todo-item
  • #11: β›“ Interface
  • #12: πŸ“ŒAdd items
  • #13: 🚧 Refactor App Component
  • #14: πŸ’… Adding Style
  • #15: πŸ”‹ Creating a Service
  • #16: 🎁 Add Items Using the Service
  • #17: πŸ’ΎLocal storage
  • #18: πŸ—‘ Remove item
  • #19: πŸ”˜ Adding a checkbox
  • #20: πŸ›° Deploy to GitHub Pages
  • #21: πŸ’ͺ Enrich the todo-item component
  • Appendix 1: Generating a new project
  • Appendix 2: Tutorial Extensions
Powered by GitBook
On this page
  • Creating a GitHub user
  • Create your App repository
  • Connecting your repository
  • Deploying to GitHub Pages
  • Known Issues

Was this helpful?

#20: πŸ›° Deploy to GitHub Pages

Previous#19: πŸ”˜ Adding a checkboxNext#21: πŸ’ͺ Enrich the todo-item component

Last updated 6 years ago

Was this helpful?

This is an old version - we should check this :)

To deploy our changes to GitHub pages we will use the angular-cli-ghpages package

  • You need to have a GitHub user

  • You need to create a repostiroy for your project.

  • You need to commit all the changes you made in the project

  • You need to install angular-cli-ghpages

Creating a GitHub user

If you already have a GitHub user you can skip this step. To Create a GitHub user go to GitHub: Fill the regetration form and make sure to validate your email address.

Create your App repository

After logging in to GitHub. Click on the Start a project button, and name the repository ng-heroes-todo or any other name you like.

Connecting your repository

Commit all your changes by runing this command in your project directory.

git add -A && git commit -m "Your Message"

Run the following command to connect your code to your repository. make sure to replace the {YOUR_USERNAME} and {YOUR_REPO} with your github username and repository name.

git remote add origin https://github.com/{YOUR_USERNAME}/{YOUR_REPO}.git
git push -u origin master

Deploying to GitHub Pages

First install angular-cli-ghpages.

npm i -g angular-cli-ghpages

Then simply run:

ng build --prod --base-href="/[your-repo-name]/"
angular-cli-ghpages

Your app will be available at [[https://[your-GH-username].github.io/[repo-name](https://[your-GH-username].github.io/[repo-name)](https://[your-GH-username].github.io/[repo-name](https://[your-GH-username].github.io/[repo-name))\]

Known Issues

On (windows) machines you probably run into an issue like the following:

An error occurred!
 Error: Unspecified error (run without silent option for detail)
    at C:\Users\<myuser>\AppData\Roaming\nvm\v8.9.1\node_modules\angular-cli-ghpages\node_modules\gh-pages\lib\index.js:232:19
    at _rejected (C:\Users\<myuser>\AppData\Roaming\nvm\v8.9.1\node_modules\angular-cli-ghpages\node_modules\q\q.js:844:24)
    ...

Try to debug it with angular-cli-ghpages -S . If you get the following error:

fatal: could not read Username for \'https://github.com\': No error\n',

you can do the following

  1. Run the following command and replace your token, organisation (your user), repository, username and email:

    angular-cli-ghpages --repo=https://<personal-access-token>@github.com/organisation/your-repo.git --name="Displayed Username" --email=mail@example.org

For more information see .

Create a Personal Access Token here:

https://github.com/angular-buch/angular-cli-ghpages
https://github.com/
https://github.com/angular-buch/angular-cli-ghpages
https://github.com/settings/tokens