在Windows2012下配置Mercurial

來源:互聯網
上載者:User

標籤: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找到):

    • 將首行改成指向python.exe位置

#!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")

  1. 修改Apache的設定檔http.conf,在最後添加一行

ScriptAlias /hg "C:/xampp/htdocs/hgweb/hgweb.cgi"

  1. 不過這樣只能訪問一個庫,想訪問多個庫,需要使用hgweb.config檔案,hgweb.cgi中將config變數賦值為hgweb.config

<span style="white-space:pre"></span>config= "hgweb.config"

  1. hgweb.config檔案內容為

[collections]D:/hg= D:/hg [web]allow_push= false allow_pull= false allow_read= false push_ssl= false style= gitweb 

  1. 用htpasswd.exe建立使用者密碼檔案。htpasswd.exe在apache的bin目錄可以找到,使用方法主要有
    • htpasswd -c 檔案名稱 使用者名稱               //參數-c建立密碼檔案,輸入後會提示你輸入密碼
    • htpasswd 檔案名稱 使用者名稱                 //如果使用者名稱一樣會更新密碼

舉個例子,我現在要建兩個使用者

htpasswd-c hguser fatkun.comhtpasswdhguser aaaa

這時會得到一個hguser的檔案,把它拷貝到conf目錄下

  1. 在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


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.