標籤:windows mercuial apa
所需的安裝檔案:
- xampp-win32-1.8.3-4-VC11-installer.exe
- python-2.7.7.amd64.msi
- tortoisehg-3.0.1-x64.msi
- mercurial-3.0.1.win-amd64-py2.7.exe
- mercurial-3.0.1-x64.msi
- server-jre-8u5-windows-x64.tar.gz
1. 使用TortoiseHg建立一個版本庫:在D:下建立hg檔案夾,進行D:\hg,右擊,選擇TortoiseHg | Create Repository Here。
2. 在C:\xampp\htdocs下建立一個檔案夾,hgweb
3. 在C:\xampp\htdocs\hgweb中建立hgweb.cgi檔案,內容如下(最新的內容可http://www.selenic.com/hg/file/tip/hgweb.cgi找到):
#!C:/Python26/python.exe
importcgitb; cgitb.enable()
- 第六行的注釋:# Path to repo or hgweb config to serve (see ‘hg help hgweb‘),是說config變數可以指向倉庫,也可以指向一個設定檔。先簡單點,指向倉庫,將第七行改為
config= "D:/hg"
- 安裝mercurial-3.0.1.win-amd64-py2.7.exe,顯示安裝在C:\Program Files\Lib\site-packages,將
importsys; sys.path.insert(0, "C:/xampp/mlib")
改為
importsys; sys.path.insert(0, "C:/Python26/Lib/site-packages")
- 修改Apache的設定檔http.conf,在最後添加一行
ScriptAlias /hg "C:/xampp/htdocs/hgweb/hgweb.cgi"
- 不過這樣只能訪問一個庫,想訪問多個庫,需要使用hgweb.config檔案,hgweb.cgi中將config變數賦值為hgweb.config
<span style="white-space:pre"></span>config= "hgweb.config"
- hgweb.config檔案內容為
[collections]D:/hg= D:/hg [web]allow_push= false allow_pull= false allow_read= false push_ssl= false style= gitweb
- 用htpasswd.exe建立使用者密碼檔案。htpasswd.exe在apache的bin目錄可以找到,使用方法主要有
- htpasswd -c 檔案名稱 使用者名稱 //參數-c建立密碼檔案,輸入後會提示你輸入密碼
- htpasswd 檔案名稱 使用者名稱 //如果使用者名稱一樣會更新密碼
舉個例子,我現在要建兩個使用者
htpasswd-c hguser fatkun.comhtpasswdhguser aaaa
這時會得到一個hguser的檔案,把它拷貝到conf目錄下
- 在httpd.conf配置末尾加上
<Location/hg> AuthType Basic AuthName "Mercurialrepositories" AuthUserFile"D:/JAVASoftTool/xampplite/apache/conf/hguser" Require valid-user </Location>
另外解壓server-jre-8u5-windows-x64.tar.gz檔案,加上JAVA_HOME、Path等環境變數後XAMPP中的tomcat還是無法啟動,需要將註冊表中HKEY_LOCAL_MACHINE\Software\JavaSoft\JavaRuntime Environment\ 添加
JavaHome REG_SZ C:\JAVA
參考檔案:
在Windows使用apache搭建Mercurial WEB版本控制服務
Mercurial(HG)版本控制服務使用者名稱驗證
apache搭建Mercurial(HG)版本控制服務及許可權控制
java配置環境中jdk和jre