Skip to content

shan7030/angular-app-github-pages-example

Repository files navigation

This repository demonstrates the use of deployment using Github pages for Angular Application . The deployed application can be found here

website Angular

Steps for Angular Application Deployment using Github Pages

  1. 🚀 Create new Angular Project (You can create one using angular-cli)
  2. 🔨 Now create the web-app according to your need, you can use angular-cli for code scaffolding
  3. 🚀 Create new Repo on Github
  4. 🗃️ Clone the git repo locally using :
    git clone https://github.com/username/reponame.git
  5. Open terminal/command line (make sure you have git installed), make sure that you are in project directory
  6. Type the following commands to push the code on github:
    git init
    git add .
    git commit -m "Initial Commit"
    git remote add origin https://github.com/username/reponame.git
    git push -u origin master
  7. Now, go to github repo and your code should be uploaded to master branch on github
  8. Next Install the angular-gh-pages using npm:
    npm install -g angular-cli-ghpages
  9. Next, production build the angular application using:
    ng build --prod --base-href "https://username.github.io/reponame/"
  10. Atlast, create the gh-pages branch, also upload the build and bundled code to this branch using :
    ngh --dir dist/reponame
  11. 🥵 Now you application is successfully deployed using Github pages
  12. 🚀 You can find the link of deployed application in Settings Tab -> Github Pages

For more detailed steps for installation of angular-cli, git, etc. you can refer this article on Geeks for Geeks by me.