Angular: deploy build and publish in github

Pradeepa Kathiresan
1 min readSep 28, 2020

Method1:

push an existing repository from the command line

git remote add origin https://github.com/pradeepakv/fashioHtoA.git
git branch -M master
git push -u origin master

Steps to deploy build and publish gh pages for any Angular projects:

In the angular.json file, change the outputpath value to “docs/

ng build --prod --baseHref="https://username.github.io/respository-name/"

Code Commit

git add .
git commit -m "generated deployables"
git push -u origin master

Configure Your GitHub Repository for Publishing on GitHub Pages

Once the docs folder is pushed into your GitHub repository, you need to open the repository settings and go to the GitHub Pages section and select “master branch/docs folder” from the source dropdown. And that’s it!

— — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Method2:

Add in package.json:

"homepage": "https://accountName.github.io/repositoryName"

Open Git bash and execute following commands:

1.npm i angular-cli-ghpages --save-dev
ng add angular-cli-ghpages
2. ng build --prod--baseHref="https://pradeepakv.github.io/fashionHtoA"3.ng build --prod --output-path docs —-base-href /<project_name>/ng build --prod —-output-path project —-base-href "https://pradeepakv.github.io/fashionHtoA"4.ng build

5. ngh —-dir=dist/fashionHtoA

Now in github, settings-> GitHub Pages ->generate url
change source to ghpages

You Are Done :) Happy to go….

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Pradeepa Kathiresan
Pradeepa Kathiresan

Written by Pradeepa Kathiresan

I am open to cross-train and interested in learning new technology.

No responses yet

Write a response