Click here to Skip to main content
15,886,799 members
Articles / AngularJs

Configure Git with Visual Studio Code

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
3 Sep 2016CPOL2 min read 68.7K   10   1
How to configure Git with Visual Studio code

In this post, 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 the capability to be integrated with TFS repository (CVCS).

After searching the net, I still could not make out what is the easiest & straightforward 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 needs 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.

Before starting to follow the below 5 steps, please make sure that Git is installed on your system. If not, please download & install Git for Windows from https://git-scm.com/downloads.

Let’s see what those 5 steps are:

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

Step 2a: Open Visual Studio Code

Step 2b: Go to View > Integrated Terminal

Step 2c: Navigate to the directory (Use DOS CD command) where the remote Git repository needs to be cloned. Let's 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 whenever 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> as 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, or 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!

Filed under: AngularJS, CodeProject, JavaScript Editor, Visual Studio Code, Web Development

Tagged: AngularJS, DVCS, Git, Git Configuration, Visual Studio Code, VSC

Image 6 Image 7 Image 8 Image 9 Image 10 Image 11 Image 12 Image 13

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Infinite Computer Solutions
India India
Dear Technologists,

This is Mohit Jain, working in Bangalore as Technical Architect. I love to work in Microsoft Technologies. I am having rich 16+ years of experience. Started career with VB, ASP then moved to .Net. I have worked with fortune 500 reputed clients like Microsoft, American Express, Iron Mountain and Xerox etc and helped them in Design, Solution, Execution and Implementation of enterprise applications.

I own MCTS in Web and Windows Development, MCPD in Web, Windows and Enterprise Development, MCSD in Web and Windows Development. I have extensive knowledge on ASP.Net, C#, VB.Net, ASP, JavaScript, Web Services, WCF Services and SQL Server.

If you have any challenges in .Net code, feel free to contact me at mail_mohitjain@yahoo.co.in, I will try my best to help you out.

Comments and Discussions

 
QuestionThanks Pin
Châu Giang12-Sep-16 18:09
Châu Giang12-Sep-16 18:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.