Deploying Angular Project To GitHub Using GitHub Pages
Note:
node --version = v14.20.0
npm --version = 6.14.17
ng version
Angular CLI: 14.0.0
Node: 14.20.0
Package Manager: npm 6.14.17
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1400.0 (cli-only)
@angular-devkit/core 14.0.0 (cli-only)
@angular-devkit/schematics 14.0.0 (cli-only)
@schematics/angular 14.0.0 (cli-only)
First Open your project in vscode editor, and then open terminal
Now open your Git account and create new repository in Git.
Go Back to vscode terminal, and type command
ng build --configuration production --base-href "https://AbhiGit799.github.io/demo-ang-sitegit/"
Here, "https://<username>.github.io/<repo-name>/"
https://AbhiGit799.github.io/demo-ang-sitegit/
you can take from url as shown below
After successful execution of above command dist folder get created inside your angular project.
Now right click on this folder and open terminal
And execute command git init
After that execute
git remote add origin https://github.com/AbhiGit799/demo-ang-sitegit.git
you can find this command from your git repository after creating repository git give this command
After that from left hand menu open git menu and give commit message and click on commit button
Now go back to your git repository and refresh page.
Now go to settings--->Pages
Make changes in the Pages menu as shown in above screen shots. Now wait and refresh the page and go back to code menu and again come back to page menu
Now site is ready. You can check the link by clicking visit site.
Reference Links:-
https://medium.com/tech-insights/how-to-deploy-angular-apps-to-github-pages-gh-pages-896c4e10f9b4
https://www.npmjs.com/package/angular-cli-ghpages?activeTab=readme#prerequisites
https://www.c-sharpcorner.com/blogs/a-guide-on-how-to-deploy-angular-applications-to-github-pages
Reference Video Links:-
https://www.youtube.com/watch?v=wElk1W1BJ2o
https://www.youtube.com/watch?v=iYwboA7CVlE
Main commands used:
npm i angular-cli-ghpages
ng build --configuration production --base-href "https://AbhiGit799.github.io/demo-ang-sitegit/"
ng build --configuration production --base-href "https://AbhiGit799.github.io/demo-ang-sitegit/"
git init
git remote add origin <url_provided_by_git>
Comments
Post a Comment