Windows下配置Git伺服器和用戶端 超全

來源:互聯網
上載者:User

標籤:

為了配合Redmine使用,特地用Git來做版本控制。

 

 

Git Candy© 是一個基於ASP.NET MVC的Git分布式版本控制平台,Git Candy的目標是輕鬆幹掉Bonobo,逐漸追趕Github,並用微創新超過Github.

源碼在:http://github.com/Aimeast/GitCandy
示範在:http://git.53wb.com https://gitcandy.com/Repository

Bonobo到GitCandy資料庫轉換程式:http://git.53wb.com/Repository/Tree/Bonobo2Candy/

 

選擇Git伺服器部署策略

找了一圈,發現如下方法來架設Git伺服器:

  1. Git Candy:http://github.com/Aimeast/GitCandy/ AE大神的作品, Git Candy© 是一個基於ASP.NET MVC的Git分布式版本控制平台,Git Candy的目標是輕鬆幹掉Bonobo,逐漸追趕Github,並用微創新超過Github
  2. Bonobo Git Server:http://www.chodounsky.net/bonobo-git-server/ 需要IIS6+/.net 4/asp.net MVC 3,官方提供了比較詳細的安裝說明,但據說問題不少
  3. WebGit.NET:https://github.com/otac0n/WebGitNet/wiki/Getting-Started 需要IIS/asp.net MVC 3/msysgit,好久不更新了
  4. Git-Web-Access:https://github.com/yysun/Git-Web-Access 又一個MVC開發的,也好久沒有更新
  5. git-dot-aspx:https://github.com/JeremySkinner/git-dot-aspx 需要iis7+/.net 4/asp.net MVC 2,也好久沒有更新
  6. Grack:https://github.com/schacon/grack  需要ror環境,也好久沒有更新
  7. GitStack:http://gitstack.com/ 對系統的要求比較高,2003/xp就無法支援了
  8. scm-manager:https://bitbucket.org/sdorra/scm-manager 需要Java環境,更新比較頻繁,安裝配置比較簡單
  9. Gitblit:http://gitblit.com/ 同樣需要Java環境,安裝配置比較簡單
  10. Gitalist:http://www.gitalist.com/ 需要perl環境,安裝配置也簡單
  11. Indefero:http://www.indefero.net/open-source/ 需要PHP/MySQL/Apache等,好久不更新
  12. Git Daemon即守護進程:通過git daemon --reuseaddr --base-path=/path/to/git/啟動,通過git://協議進行訪問,使用9418連接埠進行通訊,需要配合Gitosis才能好用
  13. Gitolite:https://github.com/sitaramc/gitolite 需要cygwin/ssh以及一堆設定
    1. http://therightstuff.de/CommentView,guid,b969ea4d-8d2c-42af-9806-de3631f4df68.aspx
    2. http://beta.wikiversity.org/wiki/Topic:Git/%E5%9C%A8Windows%E4%B8%8B%E5%AE%89%E8%A3%85Gitolite
  14. gitosis:https://github.com/tv42/gitosis 需要cygwin/ssh以及一堆設定
    1. http://markembling.info/2009/08/git-server-gitosis-and-cygwin-on-windows
    2. http://jerabi.com/sdionne/blog/2010/09/06/git-repository-server-gitosis-on-win7-working/
  15. GitLab:http://gitlabhq.com/ 需要ruby/Gitolite/Nginx等一堆
  16. CopSSH+msysgit+putty等工具,配置好繁瑣
    1. http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP
    2. http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/
    3. http://www.codeproject.com/Articles/296398/Step-by-Step-Setup-Git-Server-on-Windows-with-CopS
  17. 通過GitHub.com,或者類似的託管服務,這個是最省事的了
  18. Windows檔案分享權限設定,但是不利於許可權控制,極不推薦
    1. git remote add origin file:///ipaddress/sharename/
    2. git clone file:///ipaddress/sharename/

通過比較發現需要CopSSH/Cygwin等環境的應用配置起來比較複雜,剩下的幾個支援git smart http協議的web應用配置起來比較簡單:

  1. Bonobo Git Server
  2. WebGit.NET
  3. Git-Web-Access
  4. scm-manager
  5. Gitblit
  6. Gitalist

最後再根據更新/穩定等因素篩選出Bonobo Git Server、scm-manager、Gitblit,結果最終選擇了scm-manager。

配置scm-manager

在機器上安裝java環境,從http://java.com/zh_CN/download/manual.jsp選擇離線版下載安裝

從https://bitbucket.org/sdorra/scm-manager/wiki/download下載最新的scm-server-1.24-app.zip

安裝為系統服務:

1 scm-server.bat install

然後在系統服務裡設定為自動啟動,然後啟動服務就可以通過http://localhost:8080訪問了,預設使用者名和密碼都是scmadmin。

登進系統以後通過Repository Types修改Git中心庫存放的路徑。

修改預設的管理使用者名或者是其他的一些配置都可以找到%userprofile%\.scm\config目錄下的相應xml設定檔來修改,注意要重啟scm-server服務。

更新:低版本作業系統如server 2003可能會在C:\Documents and Settings\Default User\.scm這樣的目錄下,而不是目前使用者檔案夾

如果要啟用郵件以及提醒,還需要安裝外掛程式scm-mail-plugin、 scm-notify-plugin,然後在設定中把Mail相關的SMTP設定填寫好。

如果代碼提交要跟Redmine關聯,還需要安裝外掛程式scm-redmine-plugin,然後在項目資訊裡的Redmine選項卡配置Redmine地址為http://localhost:3000;

如果要啟用更新、自動關閉,還需要scm-manager和redmine使用同樣的使用者名稱密碼,而且Redmine設定裡必須啟用REST API;

然後在提交的時候需要用git commit –m “(#問題ID) fix 修複內容”來關閉問題,可以用的關鍵字如fix,fixed等可以自行配置。

用戶端安裝

不管最終是使用那一種用戶端(Git Extensions:http://code.google.com/p/gitextensions/或TortoiseGit:http://code.google.com/p/tortoisegit/),msysgit都是必須安裝的:從http://msysgit.github.com/下載最新的Git-1.8.0-preview20121022.exe安裝即可。

偏向使用命令列的只裝msysgit就足夠了;如果要使用圖形介面可以選擇msysgit內建的git gui,或者是另外安裝git extensions或tortoisegit;個人感覺git extensions的圖形介面比較強大,如果安裝它的話一定要安裝上KDiff3。

更便捷的就是與Visual Studio整合了,Git Extensions安裝的時候可以選擇安裝Visual Studio外掛程式整合;另外還有一個工具可以進一步提升便捷性Git Source Control Provider:http://gitscc.codeplex.com/,它依賴於msysgit和git extensions,可以在官方網站下載安裝或者在visual studio擴充管理裡面搜尋git進行安裝。

Git配置

Git用戶端安裝好之後最好配置一個全域的使用者名稱及郵箱:

12 git config --global user.name "Your Name Here"git config --global user.email [email protected]

這個配置在建立Repository時可能會用到;另外可以通過一下命令來查看配置:

1 git config --list
Git相關資料
  1. Pro Git 中文版:http://git-scm.com/book/zh http://progit.org/book/zh/ 有牆,用google隨便找一個PDF版直接下載
  2. Git Community Book 中文版:http://gitbook.liuhui998.com/index.html
  3. Git Magic:http://www-cs-students.stanford.edu/~blynn/gitmagic/intl/zh_cn/
  4. Git開發管理之道:http://blog.leezhong.com/translate/2010/10/30/a-successful-git-branch.html
  5. 如何高效利用GitHub:http://www.yangzhiping.com/tech/github.html
  6. 圖解Git:http://marklodato.github.com/visual-git-guide/index-zh-cn.html
  7. 筆記《版本控制之道--使用Git》:http://www.nshen.net/sitelog/2011/08/03/git-note.html
  8. Git 故事連載:http://gitstory.wordpress.com/category/git/ Git Web Access作者寫的(注意有牆)

另外還可以從Git Immersion一步一步演練:http://gitimmersion.com/lab_01.html

Windows下配置Git伺服器和用戶端 超全

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.