Configuring Visual Studio 2013 to use Git as Source Control


Visual Studio 2013 has ability to integrate Git source control. The blog post will shows in details how to configure Visual Studio to use Git, with remote repository at git.com. Configuration can be divided in several parts.

1. Installing required softwares

2. Creating SSH key and uploading to Git server

3. Configuring local Git repository and sync with remote server

4. Check in and check out source code.

Installing Git Extensions

Only software you have to install is Git Extensions for Windows which you can find on: http://code.google.com/p/gitextensions/

1. After you download Git Extension installer, start the installation process. The following images show  step during the installation process.

gitblog_inst_sl1
gitblog_inst_sl3
gitblog_inst_sl2
gitblog_inst_sl4

At this step,in some case you can get the error in the installation with the following message:

‘Installation directory must be on local hard drive’

In that case, open Command Prompt with Administrator priviledge, go to folder GitInstaller is downloaded and type the following command:

msiexec /i GitExtensions.msi WIXUI_DONTVALIDATEPATH=”1″ 

where GitExtension.msi is the name of your installer.

Continue with installation:

gitblog_inst_sl7
gitblog_inst_sl5
gitblog_inst_sl6

Now proceed with installation of two installers: KDiff and GIT. Follow the default setup options:

gitblog_inst_sl20

gitblog_inst_sl14

Finish the installation process:

gitblog_inst_sl22

gitblog_inst_sl21

 

Creating SSH key and uploading to Git server

After you installed Git Extension open the Git Extention from Desktop :

Put UserName and Email to login information:

gitblog_inst_sl23

gitblog_inst_sl24

 

By clicking on OK button, Git Extension displays start screen. From Tools menu choose  Git Bash command line tool to create SSH key.

 

gitblog_inst_sl25

 

From the picture below follow the instruction how to create SSH Key.

type: ssh-keygen -t rsa -C email@company.com, and press enter 4 times. By pressing Enter you accept default options.

gitblog_inst_sl27

 

After you create the key, you have to add it to local agent.

1. First start local agent: exec ssh-agent Bash   (eval `ssh-agent -s`)

2. Type ssh-add ~/.ssh/id_rsa

gitblog_inst_sl28

Add SSH key to GitHub

1. Open you Git Hub account

2. Go to Settings

3. Add SSH Tab

4. Press AddKey

5. Copy the Content of the id_rsa.pub (see picture below)

 

6. Paste to GitHub SSH key tab

gitblog_inst_sl30

You can test your account by typing ssh-T git@github.com to command line.

gitblog_inst_sl31

Now you are ready to use GitHub Source control.

Configuring local Git repository and sync with remote server

 

1. Define local repository path: C:/tfs/Git

2. Open GitExtensions: Open local repository:

gitblog_inst_sl32

 

2. Initialize local repository

 

gitblog_inst_sl33

 

Setup Remote Repository by specifing Name and SSH path of the project:

gitblog_inst_sl34

 

By pressing Save Changes from the last image, you setp the project and it is ready to be opened in Visula Studio.

Open Visual Studio 2013

Add local repository to Git

Double click on the project to get solution file to open:

gitblog_inst_sl35

Advertisement

How to delete VisualStudio.com project from Windows 8.1 and Visual Studio 2013


More than year ago, I wrote blog post article how to delete project from tfspreview.com. I can say this blog post is one of the most visited post, probably because lot of people wanted to delete project but it is not so obvious task.

Today I run in the similar problem with Windows 8.1 OS and Visual Studio 2013 RTM version. In fact when I open Start Screen I wasn’t unable to find icon VS2013 x64 Native Tools Command Prompt, but only command prompt for VS 2012 which is not working because you have no VS2012 installed.

Actually you have to choose Visual Studio Tools folder from Visual Studio 2013 category.

visualStudio2013Tools 

Windows Explorer Window is opened.

visualStudio2013Tools1

 

Now select VS2013 x64 Native Tools Command prompt, and follow instruction in the previous blog post from  this link.

CodeLens amazing feature in VS 2013


Visual Studio 2013 is available few hours ago. The main features are already presented through CTP and RC version. Started from today, MSDN subscribers can download VS 2013, and public availability will be 13th of November this year.

One of the best feature in this release is definitely CodeLens.

CodeLens is new feature in Visual Studio 2013 which provides lot of information through the code editor. It is amazing how UI team from Microsoft design this feature by combining text in code with floating and docking windows. For me, this is the best feature in the last several versions.

In this blog post it will be presents several case when you can use CodeLens to find information specific to you code e.g. Unit test methods, class definitions etc.

Full Power of CodeLens you can feel when you have installed Visual Studio 2013, TFS 2013 and Lync 2013.

As you can see CodeLens uses different services to provide information about your code, people worked on code, communication between developers, and more.

Here is some hints about CodeLens

Enabling CodeLens

You can enable CodeLens in Options dialog. You can also enable specific information provided by CodeLens. Picture below shows CodeLens options.
101713_1512_CodeLensama1.png

Reference, Definitions and other information

Reference counter, and other very useful information is integrated in to code editor like picture below. The constructor of every class contains information about reference number, test methods, as well as Code changes, date and time changes, review etc. On picture below you can see reference number and test methods.

 

If you run VS 2013 with TFS 2013 you can get other information like (see picture below taken from Microsoft site) last change author, total changes, review and other information.

If you have installed Lync 2013 you can call directly from code editor other dev. team member. This is amazing feature.

Using Code Lens with CodeMap

You can combine CodeLens with CodeMap, by clicking on the link at the bottom of CodeLens floating window.

CodeLens_CodeMap

Peek Definition

When you right click on some type, now you have a new option called “Peek Definition” which provide developer athoder window inlined within current code edito and shows information about selected type.

In previous action, this option is achieved by showing another window, while current windows was hide. Now you can see information, even you can make some modification if you like, but you current window edition still remain and it is presented all the time. At the edn you can Peek definition promote to standard tab windows if you like. In the nexst cup of picture you can see how it looks like.

Right Click on method:

Choose Peek Definition

Inline windows is present with definition of the method. You can scroll and edit this window. It is like ordinary window. You can use ScrollBar too, in case you need some other information within it. You can promote this windows in to ordinary, by clicking on icon from the Title.

More information you can find here.

That was my first impression for this release.

Again Microsoft and Visual Studio team done great job.

Happy programming!