Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AtienoObwanda/a8af0086b7bbbd93b3b3630d385c9b72 to your computer and use it in GitHub Desktop.
Save AtienoObwanda/a8af0086b7bbbd93b3b3630d385c9b72 to your computer and use it in GitHub Desktop.
Deploying an Angular App to Github pages
Deploying an Angular App to Github pages
Prerequisite:
A github account
A Github Repo
Deployment to gh-pages:
Create a Github repository for your project.
Push your code to the main branch
Create a gh-pages branch - This is an invaluable hack that will help us get the gh-pages link to help us set the base-href
Navigate to the settings of your Github repo to get the link to the published site
Back to your project locally add the angular-cli-ghpages
ng add angular-cli-ghpages
Then deploy your app using ng deploy command
ng deploy --base-href=your link to gh-pages
Note: replace your link to gh-pages with your actual link to gh-pages
UPDATED: If the App shows the README file, please navigate to the gh-pages setting on Github and ensure that the selected branch is gh-pages but not main or master.
References:
https://angular.io/guide/deployment#deploy-to-github-pages
npmjs package 'angular-cli-ghpages'
You may also like ⇒ Deploying Angular Apps to Netlify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment