Angular to GitHub Pages
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 Projecticon in the left menu, across fromProject, to download your project as a zip archive.
or
- Clone your Project from GitHub.
To run your project locally, you need the following installed on your computer:
- Node.js.
- The Angular CLI. From the terminal, install the Angular CLI globally with:
npm install -g @angular/cli
then cd to your project
| |
To download and install npm packages, use the following npm CLI command:
| |
Use the following CLI command to run your application locally:
| |
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:
| |
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
| |
Open the Github Powershell or cmd.exe or Git Bash(you need to have git as an environment variable) and execute the following command :
| |
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
Escand then type:wqto save and exit.
git push
Final and Example
chienhsiang-hung/Getting-started-with-Angular: Created with StackBlitz ⚡️ (github.com)
Angular Getting Started (chienhsiang-hung.github.io)
Contact me: Hung, Chien-Hsiang (chienhsiang-hung.github.io)