Skip to content

GitHub as source control for Visual Studio

This is a guide for using GitHub, https://github.com/, as source control for Visual Studio. A prerequisite is that you have Visual Studio installed. I am not an expert on Git/GitHub, I am rather new to it. I write this as a note about how I did it and about what I have experienced and learned about it.

Introduction

GitHub

At https://github.com/ you can share code and have free source control. Public code you save for free, private code costs $7 per month (2012-01-04). If you want to start to use GitHub you get good help at http://help.github.com/.

Git

To use GitHub you need Git. Git is a free version control system (source control), http://en.wikipedia.org/wiki/Git_(software). “msysgit” is Git for Windows: http://code.google.com/p/msysgit/.

Before I started using Git I had only used Source Safe and Team Foundation Server as source control. Git is a bit different, http://progit.org/book/ch1-3.html. The biggest different as I see it for me as a user is local repositories and remote repositories. In TFS you have your local files (workspace) and you check them in or shelve them to the repository, the database. In Git you have local files and you commit them to a local repository and then you push them to a remote repository, eg. GitHub.

GUI

If you want to have more GUI with Git there are extensions to use:

Git Extensions and Tortoise Git gives you context menues in Windows explorer. Git Source Control Provider is an add-in to Visual Studio and gives you the feeling you have when working with TFS or Source Safe. At the same time it is an extension to Git for Windows, Git Extensions and Tortoise Git, it gives you their respective context menu choices in the solution explorer in Visual Studio. You can not work against a remote repository with Git Source Control Provider it self, you need some of the others for that. You can only commit, view pending changes and view history in your local repository. If you want you can use all the extensions together.

I have decided to use Git Extensions together with Git Source Control Provider.

Installation – set up

At http://code.google.com/p/gitextensions/downloads/list/ you can download a complete package containing Git Extensions Windows installer, including “mysysgit” (Git for Windows) and KDiff3 (a tool for differencecontrol/merging). When writing this guide I used GitExtensions228SetupComplete.msi.

  • Run the set up (msi)
  • Welcome to the Git Extensions 2.28 Setup Wizard: click next
  • Installation Scope: choose and click next
  • Required Software: check both Install MsysGit and Install KDiff, click next
  • Destination Folder: leave default and click next
  • Custom Setup: leave default and click next
  • Select SSH Client: check OpenSSH and click next (Do not use PuTTY, GitHub only provides support for OpenSSH)
  • Ready to install Git Extensions 2.28: click install
  • You are now prompted to choose language, I choosed English
  • KDiff3 Setup starts
  • License Agreement: click I agree
  • Choose Components: I left default, click next
  • Choose Install Location: leave default and click next
  • Install for all users: choose and click next
  • Choose Start Menu Folder: leave default and click install
  • Completing the KDiff3 Setup Wizard: uncheck all and click finish
  • Welcome to the Git Setup Wizard: click next (there is an installation guide for Git for Windows at http://help.github.com/win-set-up-git/
  • Information (license): click next
  • Select Destination Location: leave default and click next
  • Select Components: check/uncheck as follows and click next
    • Additional icons: checked
      • In the Quick Launch: checked
      • On the Desktop: checked
    • Windows Explorer integration: checked
      • Context menu entries: checked
        • Git Bash Here: unchecked
        • Git GUI Here: unchecked
      • git-cheetah shell extension (32-bit only): unchecked
    • Associate .git* configuration files with the default text editor: checked
    • Associate .sh files to be run with Bash: checked
    • Use a TrueType font in all console windows (not only for Git Bash): unchecked
  • Select Start Menu Folder: leave default and click next
  • Adjusting your PATH environment: check Use Git Bash only and click next
  • Configuring the line ending conversions: check Checkout Windows-style, commit Unix-style line endings and click next
  • Completing the Git Setup Wizard: uncheck View ReleaseNotes.rtf and click finish
  • Completed the Git Extensions 2.28 Setup Wizard: click finish

Set up SSH keys

You need an account at GitHub for this step. If you do not have an account, create one, https://github.com/signup/free/.

Follow the guide at GitHub, http://help.github.com/win-set-up-git/#_set_up_ssh_keys.

When you are going to save your code to GitHub you do a “push”. There can be ways to “push” without using SSH keys, instead using “add remote” with https, http://gitscc.codeplex.com/discussions/277044/. I know to little about this and I dont know if it is better to do it one way or another. I have setup SSH keys. You can read more about “remotes” at http://help.github.com/remotes/.

Set up your information

Follow the guide at GitHub, http://help.github.com/win-set-up-git/#_set_up_your_info.

Install Git Source Control Provider

The installation package is at http://visualstudiogallery.msdn.microsoft.com/63a7e40d-4d71-4fbb-a23b-d262124b8f4c. You can use the Extension Manager in Visual Studio to install it.

Follow the installation guide at https://github.com/yysun/Git-Source-Control-Provider#readme or this one.

  • Run Visual Studio
  • Go to Tools | Extension Manager, search online gallery for Git Source Control Provider and install
  • Go to Tools | Options, Select Source Control
  • Select Git Source Control Provider from the drop down list, and click OK

Open your solution controlled by Git to see the file’s status. Right click within solution explorer and select “Git”. If Git for Windows, Git Extensions or TortoiseGit are installed, their commands are listed in the menu. Use the option page to disable the commands if you like.

Useful links

Advertisements
2 Comments
  1. alright, i downloaded gitextensions, gitsys and tortoisegit. but using git as source control provider in VS2010… impossible.. .cant find path to “git.exe” blablabla, lot of crap installed in this way.

    hopefully somebody can help me!

    • Is it the “Git Source Control Provider” VS plug-in that gives the “cant find path to git.exe” exception?

      Regards Hans

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: