Windows下HG伺服器的搭建

來源:互聯網
上載者:User

標籤:

1.環境和所需工具安裝

1. 安裝python-2.7.9.exe

2. 安裝mercurial-3.2.3.win32-py2.7.exe

3. 安裝mercurial-3.2.3-x86.msi

4. 安裝tortoisehg-3.3.2-x64或者tortoisehg-3.3.2-x86

5. 安裝windows iis

2.操作步驟

1. 搭建網站,建立檔案夾D:/hgweb

2. 在 IIS 中建立一個網站,名稱是 hgweb,實體路徑指向上一步的D:/hgweb

3. 在 IIS 中選擇剛才建立的網站,右側的功能視圖中選擇 “處理常式映射”,如

IIS 7.0以上的寫法

IIS 6.0的寫法

4. 在D:\hgweb下建立一個文字檔, 重新命名為test.cgi (注意連同副檔名一起修改) , 編輯其內容如下:

print ‘Status: 200 OK‘

print ‘Content-Type: text/html‘

print

print ‘<html><body><h1>It Works!</h1></body></html>‘

儲存, 然後在IIS中瀏覽test.cgi:

url: http://localhost/hg/test.cgi

介面:

如果能看到上述介面, 說明初期配置成功,繼續.

如果提示HTTP 錯誤 404.2 - Not Found

由於 Web 服務器上的“ISAPI 和 CGI 限制”列表設定,無法提供您請求的頁面

開啟IIS管理器, 定位到伺服器層級, 在其功能列表中找到ISAPI and CGI restrictions, :

雙擊開啟, 裡面必須存在如所示的行:

如果不存在則按點擊右側的”add”, 按填寫:

如果已存在, 但是被禁用, 將其啟用即可.

完成後重試開啟test.cgi, 應該可以看到it works字樣.

5. 在D:\hgweb目錄下建立一個文字檔, 重新命名為hgweb.cgi, 編輯其內容為以下幾句話:

#!/usr/bin/env python

#

# An example hgweb CGI script, edit as necessary

# See also http://mercurial.selenic.com/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see ‘hg help hgweb‘)

config = "D:/hgweb/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide:

#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:

#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()

from mercurial.hgweb import hgweb, wsgicgi

application = hgweb(config)

wsgicgi.launch(application)

然後再在D:\Mercurial下建立一個文字檔, 重新命名為hgweb.config, 不需要寫入任何內容, 即可嘗試瀏覽http://localhost:8080 /hgweb.cgi . 應該能看到如下介面:

6. 修改hgweb.config

[paths]

/Repositories/ = E:/myweb/*

[web]

baseurl = /hgweb.cgi

allow_push = *

push_ssl = false

7. 建立代碼倉庫

在D:/hgweb下面建立test檔案夾,在檔案夾中執行建立hg create

再次訪問hgweb.cgi,可以看到如的畫面:

8. 同步

在要同步的電腦上輸入hg clone

9. 提交代碼

修改檔案後,在設定中將使用者名稱設定為提交使用者名稱

Windows下HG伺服器的搭建

聯繫我們

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