In this article, we will follow a step-by-step approach to deploy an Angular application to a GitHub. We will create a project using Angular CLI and then deploy that to GitHub. Let us get started.
To create a project using Angular CLI. Run the command:
ng new demo
You need to make sure that Angular CLI is installed globally on your machine.
Change directory to demo and open project in VS Code or any other IDE of your choice. Modify AppComponent to add, subtract, multiply, and divide two numbers as shown in the below listing:
As you can see, that AppComponent is very simple and it contains code to perform basic calculator operations.
Next, modify the AppComponent template
Like the component class template, it is also very simple. It uses:
- ngModel for two way data binding between input controls and properties
- event binding to call a function on click of the button
- interpolation to display the result
Before we publish this application to GitHub, let us run it locally. To run it locally, run the command
Your application should run on default port 4200 of localhost as shown in the image below:
Continue reading full articles on the Infragistics blog
Read full blog post on the Infragistics Blog
GitHub is one of the most popular code sharing platforms, following the GIT algorithm for version control. In this blog post, we will learn how to work with a GitHub repository and Visual Studio 2015, and will answer the following questions:
1. How to sync or share a project from Visual Studio to a GitHub Repository
2. How to clone a GitHub Repository in Visual Studio
Syncing or Sharing project from Visual Studio in GitHub Repository
To share the project, let’s take the following steps:
Step 1: Start with creating a Repository on GitHub. To do that navigate to https://github.com/ and click on the + sign to create a new repository. In this example, I am assuming that you have already created an account in GitHub.
Next you need to provide information including:
- Name of the repository
- Description of the repository
- Whether repository is public or private
- Whether to initialize the repository with a README.
Make sure not to initialize the repository with a README. If you do so, you will encounter errors while syncing the project to the repository. Once the repository is created, click on Clone or the Download dropdown and copy the web URL as shown in the image below. We’ll need the GitHub repository URL later in Visual Studio.
Step 2: Install Git for Windows on the machine. You can download this here: https://git-scm.com/download/win. After downloading, follow the screens to install completely.
Step 3: Open the Visual Studio solution you want to publish to this GitHub repository in Visual Studio. In the Visual Studio Solution Explorer, right click on the solution and click on Add Solution to Source Control.
Read full blog post on the Infragistics Blog
In my trainings, often I get a question from junior developers that how to clone a Git repository in the visual studio? Perhaps it may be very simple for senior developers, however for the developers who struggle to get it right steps are discussed below,
Find the URL of the remote git repository. For GitHub repository URL can be found as shown in the image below. Copy the URL from here.
Launch Visual Studio and from the View select Team Explorer. In the Team Explorer window select Clone.
On clicking Clone, you will get an option to provide the URL of the Git repo and the choose folder in which repository will be cloned. In the URL section paste the remote repository URL as whon in the below image:
As the last step click on the Clone and the remote Git repository will be cloned in the Visual Studio in the given folder. If everything goes right you will get success message as shown below.
I hope it helps. Thanks and Happy Coding.
Have you come across the error as shown in below image?
You get the above shown error in Visual Studio while pulling changes from the git server. This error causes because you have local changes without the commit. In this scenario the visual Studio does not give very readable error message. Perhaps you may want to use git command for pull for more information on the error.
The git pull command clearly says that either commit the changes or stash them. If you are not sure about the local changes then better option is to stash them. Local changes can be stashed using the git stash command.
After stashing the local changes (you can commit also) run the git pull command to pull the remote changes from the git server. You should not get any error doing pulling the latest changes.
Hope it helps. Happy coding.
While working on an application, I had to commit changes to local Git Repository. It was usual task and I started with following command,
git add –A
To surprise git add command gave me error as shown in image below. Error message was clear that to a particular file there was Permission denied.
Note: I was working on a MVC application which had local database attached. Name of database was MoviesRTM.mdf.
I tried to commit using Visual Studio 2013 as well. Here also I got same error as shown in image below,
This can be solved by two ways either shutting down IIS Express or restarting Visual Studio. I was using IIS Express to host MVC application. You can shut down IIS Express by right click on IIS Express and click on Exit from context menu.
If this option is not working then try restarting Visual Studio.
Note: Restarting Visual Studio or Shutting down IIS Express may worked in this scenario because permission denies error was on a database file (extension mdf). And database was locally created.
After shutting down I was able to run git add command successfully.