Sumit Chourasia Sumit Chourasia - 2 years ago 160
AngularJS Question

How to Connect Visual Studio 2012 with git (github)?

Microsoft launched Visual studio 2012 which can be integrated with git (and github), I'm using the following reference linking visual studio 2012 with git, but am not getting any option to commit my code. Do i need to install/use Github for windows? Or is is possible to integrate with github directly from visual studio?

This is the solution explorer not showing the Git context menu items.

Answer Source

First of all, install Visual Studio 2012 Update 3 and the Visual Studio Tools for Git to enable Git support in 2012. And you must ensure that Git for Windows is installed (Visual Studio will prompt you to install it if you haven't done so).

If you're using Visual Studio 2013 or later, Git support is built in and doesn't require any plugin installation.

Then, under Source Control, ensure that you have the "Microsoft Git Provider" enabled: Select Source Control provider

Open the Team Explorer tab. When you click the connect button in the toolbar (looks like a power plug), make sure your repository is listed under Local Git Repositories, or use the clone option to clone a repository to your system.

enter image description here

When you click clone you can enter an existing GitHub repository location, use the "HTTPS" location of your repository. Visual Studio doesn't support SSH. You can use the location picker on your GtiHub repository page to get the right clone url.

enter image description here

Select Existing GitHub

Then finally, on the Unsynced Commits tab you can click Sync to synchronize your local repository with the remote, this will ask for your GitHub credentials.


If you want to create a new repository from scratch, I have not the slightest idea of how to do that from the UI, but after creating an empty repository on GitHub, you should be able to add a new remote from the commandline. Visual Studio will then pick up that remote and allow you to push into it.

See the following steps on github to initialize an empty repository and setup the link between your local repository and github. Once you've done that, the repository should show up in Visual Studio as well (if it doesn't, add it using the add option on the connect page of Team Explorer).

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download