1、 Git,Windows下的Git,地址:http://msysgit.googlecode.com/files/Git-1.7.9-preview20120201.exe(方便下載)
2 、SSH,可以用CopSSH,地址:http://sqmcc2.newhua.com/down/Copssh_4.1.0_Installer.zip(方便下載)
3、git、CopSSH安裝可以參照(注意:看圖片就好了其它的無視):http://www.codeproject.com/Articles/296398/Step-by-Step-Setup-Git-Server-on-Windows-with-CopS
強調下:在安裝CopSSH是需要創建用戶,這裏創建的用戶是git,所以下面的地址纔可能是[email protected]
4、配置(windows系統的)git環境變量,在Path後面追加(複製下面代碼改下git的安裝路徑就可以了)
;D:\Program Files\Git\bin;D:\Program Files\Git\libexec\git-core;
5、配置copssh的(文件在安裝目錄下的etc文件夾裏)profile(複製下面代碼改下git的安裝路徑就可以了)
gitpath=`/bin/cygpath D:/Program\ Files/Git/bin` #這裏不是引號,路徑是Git下的cmd,斜槓也要用Unix的習慣
gitlibpath=`/bin/cygpath D:/Program\ Files/Git/libexec/git-core`
export PATH="$PATH:$gitpath:$gitlibpath"
6、測試
打開git bash 登陸ssh [email protected]
例如創建一個測試庫(按順序輸入):
mkdir test
cd test
git init
touch a b c d
git add .
git commit -m "init"
然後,就可以在遠程clone這個庫(test)了。clone命令如下:
git clone [email protected]:testgit aa
到此git windows下搭建環境完成。