如何将 Visual Studio 2012 与 git (github) 连接? [英] How to Connect Visual Studio 2012 with git (github)?

查看:28
本文介绍了如何将 Visual Studio 2012 与 git (github) 连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft 推出了可以与 Git(和 github)集成的 Visual Studio 2012,我正在使用以下参考 和 并设置本地存储库之间的链接和 github.完成此操作后,存储库也应显示在 Visual Studio 中(如果没有,请使用团队资源管理器连接页面上的 add 选项添加它).

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?

解决方案

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.

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

这篇关于如何将 Visual Studio 2012 与 git (github) 连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆