Thursday, August 25, 2016

How to push Angular Project to Git ?

A) Create Angular Project using Yoman

- install node.js and npm
- npm install -g yo
- npm install -g generator-webapp
- npm install -g bower
- yo webapp (Select the options during the process)
- npm install -g gulp
- gulp serve (Check if the application is running on localhost:9000)




** For reference  - Folder structures from Sublime





B) Create a new repository in Git

- Go to https://github.com/
- Signup for a new account or login to your existing account.
- Click on the + button from upper right corner and click on “New Repository”



- Enter name for your repository, optional description, choose public/private, don’t need to add .gitignore and README as we will push these files from our angular project and click “Create repostiary” button.







C) Push your code to Git

- Install git from (https://git-scm.com/downloads)

- Enter inside your project folder

$ pwd
/Users/demouser/FST
$ ls
app bower_components gulpfile.js package.json
bower.json dist node_modules test

- git init (Initialize the local directory as a Git repository.)
Initialized empty Git repository in ../FST/.git/

$ ls .git
HEAD config hooks info refs
branches description index objects

- git status (Check the status of the files)

On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)

.babelrc
.bowerrc
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
app/
bower.json
gulpfile.js
package.json
test/

nothing added to commit but untracked files present (use "git add" to track)

- git add * (This command will add the files to the new local repository. This stages them for the first commit.)

The following paths are ignored by one of your .gitignore files:
bower_components
dist
node_modules
Use -f if you really want to add them.

- git status

On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

new file:   app/apple-touch-icon.png
new file:   app/favicon.ico
new file:   app/index.html
new file:   app/robots.txt
new file:   app/scripts/main.js
new file:   app/styles/main.css
new file:   bower.json
new file:   gulpfile.js
new file:   package.json
new file:   test/index.html
new file:   test/spec/test.js

Untracked files:
  (use "git add <file>..." to include in what will be committed)

.babelrc
.bowerrc
.editorconfig
.gitattributes
.gitignore
.yo-rc.json

- git commit -m “Test First Commit”

[master (root-commit) ac58ce8] Test First Commit
 11 files changed, 454 insertions(+)
 create mode 100644 app/apple-touch-icon.png
 create mode 100644 app/favicon.ico
 create mode 100644 app/index.html
 create mode 100644 app/robots.txt
 create mode 100644 app/scripts/main.js
 create mode 100644 app/styles/main.css
 create mode 100644 bower.json
 create mode 100644 gulpfile.js
 create mode 100644 package.json
 create mode 100644 test/index.html
 create mode 100644 test/spec/test.js

- Add the git repository url as remote origin

git remote add origin “repo url"


- Push the code to github

git push origin master 




D) Check the pushed code in git



Note : Please add a README file and push both README and .gitignore to git. Its missing in repository.

No comments:

Post a Comment