Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 i'm not getting any option to commit my code. Do i need to install/use Github for windows? Or is it possible to integrate with github directly from visual studio?

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

like image 599
Sumit Chourasia Avatar asked Nov 10 '13 16:11

Sumit Chourasia


People also ask

How do I connect Visual Studio to GitHub?

In Visual Studio, select Team Explorer from the View menu. In the Team Explorer pane, click the Manage Connections toolbar icon. Click the Connect link in the GitHub section. If none of these options are visible, click Manage Connections and then Connect to GitHub.

How do I clone a repository in Visual Studio 2012?

To clone a repository you have go to Connect to Team Projects in Team Explorer, and under Local Git Repositories use the Clone pane to enter the URL of the server repository and the local destination. After the repository has been cloned, it shows up in the list, as shown below.


1 Answers

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.

Sync

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

like image 199
jessehouwing Avatar answered Oct 03 '22 04:10

jessehouwing