The site URL is shown at https://eapostol.github.io/ng2-testdeploy/
This project was generated with angular-cli version 1.0.0-beta.28.3.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive/pipe/service/class/module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.
Run ng github-pages:deploy
to deploy to GitHub Pages.
To get more help on the angular-cli
use ng help
or go check out the Angular-CLI README.
A Repository used to test deploy angular 2 projects on github.io
You should test deploy a simple angular 2 CLI project to understand how deployment on github.io works. These are the steps that you can perform to test the process out. Once you test it. Then you can perform the same steps, starting at step 14 (assuming you have a project!) on your own project.
Create a repository on Github for your project. Again make sure the repo name is simple enough so that it can also be used as a directory name...for example
ra-ng2-testdeploy
Note your project name can be whatever is appropriate. Choose no .gitignore, and no license.
- Launch a terminal on your computer.
- Go to your directory where your projects are stored.
- At the terminal, in your projects directory, type
ng new ra-ng2-testdeploy
- Wait while your new Angular 2 project is created.
- Once its done, type at the terminal
cd ra-ng2-testdeploy
-
At the terminal type npm start or ng serve and make sure your default website works as http://localhost:4200 in a web browser.
-
At the terminal, press
control-c
to stop the server. -
At the terminal, type in the following commands followed by the enter key
git init
git add .
git commit -m "#001: first commit"
- In a web browser, return to your github repository for this project and copy the git url from the "clone or download" button. It should look something like:
https://github.com/eapostol/ng2-testdeploy.git
- Return to the terminal.
- At the terminal, type
git remote add origin https://github.com/eapostol/<yourprojectName>.git
where yourProjectName is the project name added in the URL e.g. ng2-testdeploy
- At the terminal type in the following commands:
git remote -v
git push -u origin master
git pull
If you have problems with push and pull, try
git branch --set-upstream-to=origin/master
git pull
git push -u origin master
You can then proceed to develop code for the project.
- Then at the terminal (when you are ready to deploy), type in the following at the terminal AND THIS IS IMPORTANT!
ng github-pages:deploy
- Once its deployed, browse to the resultant github.io address that is shown in the terminal. It likely says something like
Deployed! Visit https://eapostol.github.io//ra-ng2-testdeploy//
If you browse and the URL doesn't show anything...wait a few minutes, then try again. if it doesn't work still...
- Go back to terminal, type in
git branch -a
and confirm that there is a remote branch that looks like
remotes/origin/gh-pages
- Once you confirm that the remote branch exists, at the terminal switch to the github io branch...
git checkout gh-pages
-
Open index.html in a text editor.
-
In index.html, note the tag. It may say something like or something similar. change it to the base URL that matches the website address you are browsing to, for example.
-
Commit or push your change to the remote repository using either git push at the terminal or use github desktop.
-
Browse to the URL of your github.io project. For example.
https://eapostol.github.io/ng2-testdeploy/
- Don't forget to update your README.MD to reference the URL of your live site.