Configure Git with Visual Studio Code


After a long time, today I got a chance to share my new learning with you all in which I will discuss how to Configure Git with Visual Studio Code. We  recently started working on an AngularJS application and decided to use Visual Studio Code Editor for development.

As a first step we needed the Visual Studio Code (VSC) to be configured with Team Foundation Server (TFS). VSC has inbuilt capability to be configured with any Git repository (DVCS). Here I would like to mention that VSC does not have capability to be integrated with TFS repository (CVCS).

After searching the net, I still could not make out what is the easiest & straight forward way to configure Git in VSC where the Remote Git Repository is already available because I did not find any UI Clone command under Git menu. Also there is no way to define the remote repository location which need to be cloned.

Git Context Menu

Git Context Menu

After playing with VSC for some time, I found the way to configure VSC with Git in just 5 steps which were easy and straight forward.

Let’s see what are those 5 steps.

Step 1: Install .Net Framework 4.5 from Web Installer or Offline Installer.

Step 2.a: Open Visual Studio Code

Step 2.b: Go to View > Integrated Terminal

Step 2.c: Navigate to the directory (Use DOS CD command) where the remote Git repository need to be cloned. Lets say we would like to clone under C:/Git/ and suppose the remote repository name is sg_angular.

Step 3: Before running the Clone command, we would be running the following command to Cache the Git Credentials in Windows else when ever Git Sync/Pull/Push command is triggered, it will ask for credentials. This step can be avoided, if you are OK to provide the password every time.

Cache Credentials to avoid prompt every time.

Cache Credentials to avoid prompt every time.

Step 4: Now type git clone <Your Remote Git Repository URL> like shown in the below picture. Press Enter.

Clone Command

Clone Command

Step 5: Credentials window should be opened. This would ask the credentials which would allow you to connect with remote repository.

Git Credentials Window

Git Credentials Window

Once the credentials are provided, VSC will start cloning the Remote Repository under navigated folder.

Make sure the git command is typed in small characters else you may get “fatal: cannot handle Clone.exe as a builtin“.

Clone Remote Git Repository using Integrated Terminal

Clone Remote Git Repository using Integrated Terminal

In order to use the local repository, Please Go to File > Open Folder and Select the folder from C:\Git\<Git Repository Folder> Or Your own folder. This will open all the files in explorer and you can start changing the files.

That’s All…

Happy Coding..


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s