Todo List Tutorial
Primary version
Primary version
  • Welcome to the ngGirls tutorial!
  • Workshop: Todo List
    • πŸ‘€About
    • #0: πŸ’ƒ Introduction
    • #1: βŒ› Installations
      • a. StackBlitz instructions
    • #2: πŸ…° Angular kicks in
    • #3: πŸ“ Component
    • #4: ✏ A new component
      • a. StackBlitz instructions
    • #5: πŸ’Ό Class
    • #6: πŸ“₯ Property binding
    • #7: πŸ“€Event binding
    • #8: πŸ“Ž Element ref - #
      • a. About
      • b. Explore
      • c. Resources
    • #9: πŸ“‹ The To Do list
    • #10: βž• New component: todo-item
    • #11: β›“ Interface
      • a. StackBlitz instructions
    • #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
    • #21: πŸ’ͺ Enrich the todo-item component
    • Appendix 1: Git and GitHub
    • Appendix 2: πŸ›° Deploying your app
      • Deploy to Azure Static Web Apps
      • Deploy to GitHub Pages
        • a. StackBlitz instructions
    • Appendix 3: Tutorial Extensions
    • Appendix 4: Generating a new project
    • Troubleshooting
      • Installation
  • More Workshops
    • Second workshops - CRUD and HTTP
      • #1 MongoDB
      • #2 Local server
      • #3 http in diagrams
      • #4 POST
      • #5 GET
      • #6 DELETE and PUT
    • Gallery with Rx.js
      • #0: Init photo gallery
      • #1: Observable
      • #2: More interaction! Upload photos
      • #3: Merging Observables
      • #4: Filtering by category
      • #5: Adding photos to category
    • Forms
      • #1: Template-driven forms
      • #2: Reactive forms
      • #3: Form builder
    • NgRx
      • #1: Actions and reducers
      • #2: Store Devtools
      • #3: Implementing actions in app
      • #4: Selectors
    • RxJS
      • Operators
      • Play time!
    • Blog Editor
      • #1 βš™οΈConfiguring firebase
      • #2 πŸ’…Add Angular Material
      • #3 πŸ’…Add Bootstrap
      • #4 🧭Add Navigation
      • #5 ✏️Add Editor
      • #6 βš™οΈConnect Database
      • #6 πŸ’…Add Feed
      • #7 ✏️Edit Post
      • #9 πŸš€Deploy
      • #10 ✏ ️Next Steps
Powered by GitBook
On this page
  • Install angular-cli-ghpages
  • Commit the changes
  • Deploying to GitHub Pages
  • Known Issues
  • Blank screen (and 404 error in DevTools in Browser)
  • Problem on Windows
  1. Workshop: Todo List
  2. Appendix 2: πŸ›° Deploying your app

Deploy to GitHub Pages

PreviousDeploy to Azure Static Web AppsNexta. StackBlitz instructions

Last updated 4 years ago

StackBlitz Instructions

Follow the instructions on the page in this chapter to rename your StackBlitz project and share the link to your app.

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

  • You need to install angular-cli-ghpages

  • You need to save the changes you made in the project

  • Run the deploy command

Install angular-cli-ghpages

We'll use an Angular CLI command to add this library to our app and automatically configure the deploy action. Run the following command:

ng add angular-cli-ghpages

Commit the changes

Commit your changes made by adding angular-cli-ghpages by running this command in your project directory.

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

Then run the following command to push the changes

git push

Deploying to GitHub Pages

Run:

ng deploy --base-href="/[your-repo-name]/"

πŸ’‘ /[your-repo-name]/ is a placeholder for your github repository name. So if you project has the name https://github.com/myname/ng-girls the value has to be: --base-href="/ng-girls/".

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

Known Issues

Blank screen (and 404 error in DevTools in Browser)

If deploy succedeed but you see blank page in browser you probably used capitalized letters in your repository name. Try to add new repository with only lowercase letters from GitHub website. Later on remove connection to old one from your local files by typing:

git remote rm

in terminal. Add connection to new repository

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

And build website again:

ng deploy --base-href="/[your-repo-name]/"

Problem on Windows

On (windows) machines you might 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, organization (your user), repository, username and email:

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

For more information see .

Create a Personal Access Token here:

https://github.com/angular-schule/angular-cli-ghpages
https://github.com/settings/tokens
StackBlitz instructions
https://github.com/angular-schule/angular-cli-ghpages