简体   繁体   中英

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?

这是解决方案资源管理器没有显示Git上下文菜单项。

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: 选择源控制提供程序

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.

在此输入图像描述

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.

在此输入图像描述

选择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).

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM