Git集成到Visual Studio 2012


 

概述

本方案是采用gitextensions+git source control provider+visual studio 2012

 

安裝環境

下載gitextensions

https://code.google.com/p/gitextensions/downloads/list

安裝的時候勾選msysGit和 KDiff3,其他全部使用默認配置即可

安裝成功后,可以看到桌面上新增如下兩個圖標

 

安裝Git Source Control Provider

在VS的"工具"--"擴展和更新"中搜索,並下載

Git Source Control Provider

下載完成后,安裝,重啟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密鑰",測試連接,通過后,點擊保存

 

 

點擊"拉取"—"解決沖突",確定后,再返回,點擊"推送",完成代碼的簽入

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM