概述
本方案是采用gitextensions+git source control provider+visual studio 2012
安装环境
下载gitextensions
https://code.google.com/p/gitextensions/downloads/list
安装的时候勾选msysGit和 KDiff3,其他全部使用默认配置即可
安装成功后,可以看到桌面上新增如下两个图标
安装Git Source Control Provider
在VS的"工具"--"扩展和更新"中搜索,并下载
下载完成后,安装,重启VS,在菜单中可以看到"Git"菜单项
在"工具"—"选项"中修改源代码管理插件为Git Source Control Provider
注册GITHUB帐号并创建库
访问 https://github.com/,并注册帐号,登录
点击右上角的"Account Settings"
选择"SSH Keys",根据如下指南新建SSH KEY
https://help.github.com/articles/generating-ssh-keys
文本如下
Welcome to Git (version 1.8.1.2-preview20130201) Run 'git help git' to display the help index. Run 'git help <command>' to display help for specific commands. Administrator@WS-WWANG-13 ~ $ get help git sh.exe": get: command not found Administrator@WS-WWANG-13 ~ $ git help git Launching default browser to display HTML ... Administrator@WS-WWANG-13 ~ $ cd ~/.ssh sh.exe": cd: /c/Users/Administrator/.ssh: No such file or directory Administrator@WS-WWANG-13 ~ $ ssh-keygen -t rsa -C "davidww11" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): Created directory '/c/Users/Administrator/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa. Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub. The key fingerprint is: 65:5f:b6:1e:92:61:53:b2:4c:34:11:fa:95:db:60:2e davidww11 Administrator@WS-WWANG-13 ~ $ clip < ~/.ssh/id_rsa.pub Administrator@WS-WWANG-13 ~ $ ssh -T git@github.com The authenticity of host 'github.com (204.232.175.90)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,204.232.175.90' (RSA) to the list of know n hosts. Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa': Hi davidww11! You've successfully authenticated, but GitHub does not provide she ll access. Administrator@WS-WWANG-13 ~ $
如上,生成KEY以后,生成PuTTY Key
打开Git Extensions
选择菜单项"远程"—"PuTTY"—"生成或者导入key"
打开菜单项"Conversions"—"Import key"
选择刚刚生成的SSH Key
选择"Save Private Key",生成PuTTY Key
新建库
在右上角,点击自己的用户名,打开自己的GIT页面,点击"Repositories",点击"New",创建一个新库"TestGit01"
连接并上传
用VS在本地打开或新建一个项目,在解决方案上右键,选择"Create Git Repository"
在解决方案上点击右键 ,选择"Git"—"Push"
选择管理远程
填写刚刚新建的库的地址
git@github.com:davidww11/TestGit01.git
加载刚刚新建的PuTTY Key文件,并点击"加载SSH密钥",测试连接,通过后,点击保存
点击"拉取"—"解决冲突",确定后,再返回,点击"推送",完成代码的签入