• Skip to primary navigation
  • Skip to main content

Nikhil Mittal

|| Software Developer || App Developer ||

  • Home
  • About Me
  • Blog
  • Testimonials
  • Achievements
  • Portfolio
  • Interview Q&As
    • Angular – QA Series 1
    • Angular – QA Series 2
    • Angular – QA Series 3
    • Angular – QA Series 4
    • Convert Angular App to Mobile APK
    • C# TYPICAL QUESTIONS – SERIES
    • Advanced Q & A – Series 1
    • Advanced Q&A – Series 2
    • Advanced Q&A Series – 3
  • Free Video Tutorials
    • ASP.NET C#
    • C# Tutorial – In Hindi
    • C# Tutorial – English
    • C#-Advanced
    • MVC DOT NET 4.8
    • Web API Dot Net Core 3.1
    • Azure DevOps
    • HTML/CSS – In Hindi
    • SQL Developer
    • Angular 10+
    • Corporate Skills
  • Consulting
  • Contact Us

Deploy an Angular App To GitHub Pages


Angular 7 Code is running in Visual Studio Code
Web API and SQL Server are the Service & DB Layer

Step 1:
git remote add origin https://github.com/USERNAME/REPOSITORY_NAME.git
Check above:
Git remote –v
Above path should be present in output as fetch and push
Step 2:
npm install -g angular-cli-ghpages
Step 3:
In your routes configuration add
RouterModule.forRoot(routes, {useHash: true});
In your index.html do this;

Step 4:
Edit the Output variable in config: dist/Project_Name to dist
Step 5:
ng build --prod --base-href ./
Step 6:
ngh --no-silent --email= --name=
Step 7: (For Version Control Add Project into master)
git init
git add README.md
git commit -m “first commit”
git remote add origin https://github.com//.git
git push -u origin master

Now you can browse your repository as well as website in Github pages
Step 8:
Go to Repository settings
Enter Custom Domain URL > Save
Remove Enforce Https option
Change A and CNAME in your personal domain
E.g.:


The DNS propagation might take 48 Hrs. to reflect the website from GitHub Pages
Step 9:
Create another sub domain Say: apis.domainname.com in windows hosting
Host your Web API here and make sure the same API Path is included in Angular App before you start
with Step 1.
Step 10:
Bingo!!
All Done

Visits: 4421
  • Home
  • About Me
  • You Tube
  • LinkedIn