This article is second blog post from our Angular2 Series. As our first attempt on Angualr2 Framework we started about "How to start Angular2 Project via angular-cli?".
Make sure your have basic idea about creating project via your machine. We can move ahead to this second blog with assumption that you have set-up angular project in your local machine.
Here we will create a repository online on GitHub. We will than initialize configuration locally in order to can keep track of our code to the repository we just created.
- Create a project on Github and copy its repository url ending with .git which is like for example: https://github.com/algosig/project-angular.git
- Open your git console. Point directory which has your angular project that you created with angular-cli as a part of previous tutorial "How to start Angular2 Project via angular-cli?"
- Initialize Project via npm. In your console type:
npm initThis loads all configuration needed to initialize in your project. And stores all those settings creating a new file package.json in your project.
After you'll enter the values for above mentioned configuration, you will see following information set by npm:
You can notice above in the screenshot the url we proided is listed inside "repository" with "type":"git". So we have added a git repository in package.json with the help of npm init. There is two more things to notice in this configuration they are the bugs and homepage.You can see adding a single url of project repository, we are by default provided with the urls for issuing the bugs and also the home page to read the ReadMe of our repository.
Now that we've linked our github repository we can now commit straight to the master and keep proper track of our project contribution. These steps are pretty easy to catch up with. But do let us know if you face any problem during configuration.
That's all about associating git repository. Second part of blog is completed here. We will continue to write about Angular2 on our next blog. Keep subscribed with our email list to get update of PART 2 of Angular2.
Related Articles: