JoseTurron
JoseTurron

Reputation: 243

Angular deploy on GitHub Pages

I'm trying to deploy an Angular app to GitHub pages but setting the gh-pages branch as the source shows the content of the README file.

I've tried the official way which is:

git checkout -b gh-pages
git push origin gh-pages
npm install -g angular-cli-ghpages
ng build --prod --base-href https://[username].github.io/[repo]/

After I run ngh I get this message in terminal:

User@JoseTurron MINGW64 /i/projekt-zaliczeniowy-cdv (gh-pages)
$ ngh
index.html could not be copied to 404.html. This does not look like an angular-cli project?!
(Hint: are you sure that you have setup the directory correctly?)
Diagnostic info: ENOENT: no such file or directory, stat 'I:\projekt-zaliczeniowy-cdv\dist\index.html'
�‍� Uploading via git, please wait...
� Successfully published via angular-cli-ghpages! Have a nice day!

I'm out of ideas on how to solve this. Thanks for any suggestions!

Upvotes: 4

Views: 2918

Answers (2)

Saad Abbasi
Saad Abbasi

Reputation: 853

Here is Step by Step Guide How to Deploy the angular app to Github pages.

1) git init //for initializing git use cmd/shell hit Enter

2)git add . //add all files in git

3)git commit -m "first commit" // message for commit

4)git remote add origin "Your Remote Repository Url" // connecting to git repo

5)git push -u origin master // pushing to git repo

6)npm install -g angular-cli-pages //installing angular pages for deploy Angular project on github pages

7)ng build --prod --base-href="https://Username.github.io/github-Repo/" //production build ghpages

8*)Goto project folder after above steps completed there will be dist folder go inside dist>YOurProjectFolder-> move all files one level up.*

9)angular-cli-ghpages //deploying ghpages

10)goto github repo setting scroll down there will be github pages and link of your publihshed repo click on that and BOOM Angular app is live on ghPages

Upvotes: 4

JoseTurron
JoseTurron

Reputation: 243

The solution is as follows:

ng add angular-cli-ghpages
ng deploy --base-href=https://[username].github.io/[repo]/ --name=[username] --email=[email]

Upvotes: 4

Related Questions