Deploy Angular App using Github Pages

Deploy Angular App using Github Pages

Please check below links for Demo of Git repo and it's deployed application:

There are various methods to deploy Angular Application such as Github Pages, Heroku, Firebase, etc. The Github provides the simplest way of all using the Github Pages.

Steps to Create and Deploy Sample Angular Application to Github Pages:

  • Install Node.js: Windows/Linux
  • Install Angular – CLI.
npm install -g @angular/cli

  • Create new project using Angular CLI command:
ng new deploy-angular-app

The above command will ask various questions for routing and Styling, press Enter to go with Default Values.

After creation of project go to the project Directory using:

cd deploy-angular-app

Application folder structure will look as 

Application folder structure will look Like this
  • Now run the Angular App locally using: npm Start

After the App Compiles Successfully, go to Browser and Open http://localhost:4200/ 




  • Next, Stop the Angular App
  • Go to Github and create new Repository with the name according to your preference
  • After creation of Github Repo, Go to the project dir and open Command Line
  • Push the Code to Git using following commands:
git init
git add .
git commit -m "Initial Commit"
git remote add origin https://github.com/<username>/<reponame>.git
git push -u origin master


  • Now, go to github repo and your code should be uploaded to master branch on github
  • Next Install the angular-gh-pages using npm:
npm install -g angular-cli-ghpages

Now, Production Build the Application using:

ng build --prod --base-href "https://<username>.github.io/<reponame>/"

Atlast, create the gh-pages branch, also upload the build and bundled code to this branch using :

ngh --dir dist/deploy-angular-app

Now go to the Settings tab parallel to Code in Github Repo and under Github Pages you will find the Link for your deployed application:

No alt text provided for this image

Open the URL and You will get our Angular App Deployed.....

To view or add a comment, sign in

More articles by Japneet Singh

  • Introduction to ChatGPT API

    OpenAI's Chat GPT API represents a groundbreaking leap forward in the realm of conversational AI. This innovative tool…

  • Azure Functions (DevOps)

    Azure Microsoft Azure is a cloud computing service created and maintained by Microsoft for building, testing…

  • Hangfire for background tasks (C#)

    Hangfire is a multi-threaded and scalable task scheduler built on client-server architecture on .NET stack.

  • SQL Dependency - Maintain Data in Cache until it's changed in DB (C#)

    Introduction A solution to maintain data in cache until it is changed in Database. Using the SQLDependency is a good…

  • CI/CD pipelines using Azure DevOps

    In this article, you will learn: Understanding and creating the continuous integration and continuous deployment using…

  • What's new in c# 6.0

    Introduction Each new version of C# has one super-feature, and few minor ones but C# 6.0 is different, because there is…

    2 Comments
  • Lazy Loading - Develop Fast & Light Angular Apps

    Introduction Application performance is an important part of web development and Lazy loading is one of the features we…

  • Oauth-2 with Refresh Token & Roles Based Authorization (C#)

    This tutorial will help you for implementing an OAuth 2.0 Authorization Server using OWIN OAuth middleware.

    4 Comments
  • Async Validations using Reactive Forms (Angular)

    Introduction While working on validations in Angular, many of you have implemented Reactive Forms Validations and you…

Others also viewed

Explore content categories