简体   繁体   English

如何使用git(github)连接Visual Studio 2012?

[英]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. 微软推出了Visual Studio 2012,它可以与Git(和github)集成,我使用以下参考链接visual studio 2012和git ,但我没有得到任何选项来提交我的代码。 Do i need to install/use Github for windows? 我是否需要安装/使用Github for windows? Or is it possible to integrate with github directly from visual studio? 或者是否可以直接从visual studio与github集成?

这是解决方案资源管理器没有显示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). 首先,安装Visual Studio 2012 Update 3Visual Studio Tools for Git以在2012年启用Git支持。并且您必须确保安装Git for Windows (如果您尚未安装,Visual Studio将提示您安装它)。

If you're using Visual Studio 2013 or later , Git support is built in and doesn't require any plugin installation. 如果您使用的是Visual Studio 2013或更高版本 ,则Git支持是内置的,不需要任何插件安装。

Then, under Source Control, ensure that you have the "Microsoft Git Provider" enabled: 然后,在源代码管理下,确保您启用了“Microsoft Git 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. 单击工具栏中的连接按钮(看起来像电源插头)时,请确保您的存储库列在Local Git Repositories下,或使用clone选项将存储库克隆到您的系统。

在此输入图像描述

When you click clone you can enter an existing GitHub repository location, use the "HTTPS" location of your repository. 单击克隆时,您可以输入现有的GitHub存储库位置,使用存储库的“HTTPS”位置。 Visual Studio doesn't support SSH. Visual Studio不支持SSH。 You can use the location picker on your GtiHub repository page to get the right clone url. 您可以使用GtiHub存储库页面上的位置选择器来获取正确的克隆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. 最后,在Unsynced Commits选项卡上,您可以单击Sync以将本地存储库与远程同步,这将要求您提供GitHub凭据。

同步

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. 如果你想从头开始创建一个新的存储库,我对如何从UI中做到这一点没有任何想法,但是在GitHub上创建一个空的存储库之后,你应该能够从命令行添加一个新的远程存储库。 Visual Studio will then pick up that remote and allow you to push into it. 然后Visual Studio将接收该遥控器并允许您进入该遥控器。

See the following steps on github to initialize an empty repository and setup the link between your local repository and github. 请参阅github上以下步骤以初始化空存储库并设置本地存储库和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). 完成后,存储库也应该显示在Visual Studio中(如果没有,请使用团队资源管理器的连接页面上的add选项添加它)。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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