How to deploy an Angular application to GitHub

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.

Step 1

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.

Step 2

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

Step 3

Before we publish this application to GitHub, let us run it locally. To run it locally, run the command

ng serve

Your application should run on default port 4200 of localhost as shown in the image below:

 

Continue reading full articles on the Infragistics blog

Working with GitHub Repositories and Visual Studio 2015

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.

image

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.

image

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.

image

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.

image

 

Read full blog post on the Infragistics Blog

How to Clone a Git repository in Visual Studio

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,

Step 1

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.

image 

Step 2

Launch Visual Studio and from the View select Team Explorer. In the Team Explorer window select Clone.

clip_image002

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:

clip_image004

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.

clip_image006

I hope it helps. Thanks and Happy Coding.

An error was raised by libgit Category =Ssh error: solved git for Visual Studio

Have you come across the error as shown in below image?

clip_image002

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.

clip_image003

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.

clip_image004

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.

Unable to index file: Permission Denied error in git add command

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.

clip_image002

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,

clip_image004

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.

clip_image006

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.

Happy coding.

Getting Started with Git and GitHub

 

 

Read complete article on Falafel Blog

Who is not talking about Git or GitHub? In one of our recent user group meetings, someone asked how many Pull Requests have you done so far in any of open source projects on GitHub. I realized many developers in the room were puzzled with the phrase Pull Request. In this post I will explain some basic Git terminology and explore basic Git commands which will help you get started with Git. In a later post I plan to show you how you can work with Git-based Source Control and Visual Studio 2013.

Let us start with understanding basic terminologies:

Repository

A Repository  is a space where projects reside. Repository can be on a local computer or at an online host like GitHub or Team Foundation Server (TFS). If you are working in project then a Repository is basic unit of working . It will contain all the files, images etc. needed for the project. It should always contains a readme file, which describes the project

Read complete article on Falafel Blog

Working with github on Windows

In this post we will see step by step to configure github for windows and the way to sync the project from windows to github repository. To start with very first you need to create a repository on github. To create repository login to github and click on New repository option

image

Once you click on New repository button you will get prompted to fill many information’s like repository name, description etc. You can make repository public or private by selecting respective radio button. If you are starting new then it is always good to initialize the repository with a README. It allows git to clone the repository immediately. Please refer below image for more on creating new repository

image

Once repository is created you will be navigated to repository page and can find all the information about repository as following image

image

At this point you have created repository in github and now you need to download and configure Windows Client of github on your machine. On the github page in the bottom you will find link to download windows client for github

 

image

After downloading and installing github windows client you will find icon on your desktop. Click that icon. Github windows client will be launched. In the left side you see local and github account. When you click on github account you will find all the repositories from the github.

 

image

To start working with github repositories, first you need to clone that. You will get clone button next to repository.

image

After successful cloning you will find button changed as shown in following image.

 

image

Double click on the repository to open it. After opening the repository you can notice in top a tool menu. From there you got option

  • Open in explorer
  • Open a shell here
  • View on github

image

To work with project select open in explorer. It will open the repository in windows explorer. Now suppose you have a visual studio solution you want to push on github, you need to follow below steps

Open VS project in window explorer and copy the solution.

image

You need to copy all files from VS solution open in windows explorer to github repository open in windows explorer.

image

After copying files to github repository open in windows explorer go to github for windows client and click on the refresh button

image

After refreshing double click on testproject repository. You may notice that a blue array next to repository name saying this repository has been modified. Click on the blue arrow or double click on the repository to navigate to detail repository page. On this screen you will find

  • Details of files to be committed
  • Option to commit the changes with comment

image

After providing comment you need to click on the commit button to commit the changes locally. After committing you will get message that one change committed locally though it is not synced.

image

To sync changes with github you need to click on sync button in top. If there is any locally committed change available then you will find sync button in blue else it would be in gray color. Once you click on sync button changes will get committed to github

image

You can verify sync in two ways. Either navigate to github and you will find all changes with comment there.

image

The other way is that you will see on github windows client in sync displayed.

image

The approach should be to put working files in local repository or cloned repository such that whenever you do any changes github for windows will detect that and you can locally commit and eventually sync with the github. In this way you can work with github and windows. I hope you find it useful. Thanks for reading.