Angular to GitHub Pages

洪健翔 Hung, Chien-hsiang
3 min readAug 15, 2022


Photo by Lautaro Andreani on Unsplash

Deploying an application

Run you project locally by

  • Download the source code from your StackBlitz project by clicking the Download Project icon in the left menu, across from Project, to download your project as a zip archive.


  • Clone your Project from GitHub.

To run your project locally, you need the following installed on your computer:

npm install -g @angular/cli

then cd to your project

cd angular-ynqttp

To download and install npm packages, use the following npm CLI command:

npm install

Use the following CLI command to run your application locally:

ng serve

Angular — Deploying an application

To build your application for production, use the build command. By default, this command uses the production build configuration.

Easy Steps to Host an Angular App in GitHub Pages | Syncfusion Blogs

In our case, the name of the repository I created is angular-app, so the command will be:

ng build --output-path docs --base-href /angular-app/

The output path is given as docs since we know GitHub Pages look for files in two folders, root and docs. In root we have all other app data, so we can’t use it here. Instead, we have given a separate output folder named docs that we are going to use to host in GitHub Pages.

The base-href is an important argument since we use it to set the base path for resolving relative URLs to stylesheets, scripts, and many other resources.

How to solve “filename too long” error in git (Powershell and GitHub Application) for windows

error: lstat("node_modules/webdriver-js-extender/built/built/built/built/built/built/built/built/built/built/built/built/built/built/built/spec/command_tests/totally_real_apk.apk"): Filename too long

Open the Github Powershell or cmd.exe or Git Bash(you need to have git as an environment variable) and execute the following command :

git config --system core.longpaths true

In my experience, you may be facing the issue:

error: could not lock config file C:/Users/.gitconfig: Permission denied

You need to go the folder of Git Bash and check the Run this program as an administrator.

Then open Git Bash directly (not from cmd or poershell etc.) and type in git config — system core.longpaths true again.

The core.longpaths sould has been set to True .

Then you’re good to commit again:

git add .

git commit

in Vim interface:

  • Type the subject of your commit on the first line. Remember to keep it short (not more than 50 characters). Leave a blank line after.
  • Write a detailed description of what happened in the committed change. Use multiple paragraphs and bullet points to give a detailed breakdown. Don’t write everything out on one line, instead, wrap text at 72 characters.
  • Press Esc and then type :wq to save and exit.

git push

Final and Example

chienhsiang-hung/Getting-started-with-Angular: Created with StackBlitz ⚡️ (

Angular Getting Started (



Recommended from Medium


See more recommendations