sudo mkdir /etc/mercurial
添加:
[web]
allow_push = *
push_ssl = false
allow_archive = gz, zip, bz2
[trusted]
users = www-data
.hgrc的添加:
cd
vim .hgrc
#type the following
[ui]
username = usertest
cd ~ # go to home directory
mkdir repository1
cd repository1
hg init
echo Hello World! > readme.txt
hg add readme.txt
hg status
hg commit -m 'My first repository!'
hg tip # shows the tip of the repository
cd /var
sudo mkdir hg
sudo mkdir hg/repositories
sudo chown -R root:www-data hg
cd /var/hg
sudo vim hgweb.config
#type following
[web]
style = gitweb
[collections]
/var/hg/repositories = /var/hg/repositories
cd /var/hg
sudo cp /home/lijian/Downloads/mercurial-2.4/contrib/hgweb.wsgi .
sudo chmod a+x hgweb.wsgi
sudo vim hgweb.wsgi
修改:
config = "/var/hg/hgweb.config"
cd /etc/apache2/
sudo mkdir mercurial
cd mercurial/
sudo vim mercurial.conf
内容:
WSGIScriptAliasMatch ^/hg(.*) /var/hg/hgweb.wsgi$1
<Directory "/var/hg/">
Options Indexes FollowSymlinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
AuthType Basic
AuthName "Mercurial Repositories"
AuthUserFile /var/hg/hgusers
Require valid-user
</Directory>
cd
/etc/apache2/sites-available
sudo
nano default
# Type on the line before
Include
/etc/apache2/mercurial/mercurial
.conf
#restart the apache server so the changes take effect
sudo
apache2ctl restart
如有问题查看/var/log/apache2/error.log [tail /var/log/apache2/error.log]
cd ~ # go to your home drive
sudo mv test/ /var/hg/repositories/.
sudo chown -R root:www-data /var/hg/
cd /var/hg
sudo htpasswd -mc hgusers admin #建立admin
sudo chown root:www-data hgusers
cd /var/hg
sudo htpasswd -m hgusers {username}# 添加用户username
sudo hg serve -p 8002
15. 客服端:
[paths]
default = http://192.168.174.129:8002/
#default-push = ssh://hgrepo@192.168.174.129//home/hgrepo/hg/repos/project
default-push = ssh://192.168.174.129//home/hgrepo/hg/repos/project
[ui]
username = jack_local<ydz@163.com>
[tortoisshg]
ui.language = en
[web]
push_ssl = true
[auth]
app.prefix = ssh://192.168.174.129
app.username = hgrepo
app.password = ydz
参考:
[1]: [http://mercurial.selenic.com/release/?M=D]
[2]:[http://omarfrancisco.com/setting-up-a-mercurial-repository-in-ubuntu-11-10/]
[3]:[http://www.linuxidc.com/Linux/2011-07/39290.htm]
[4]:官网介绍:[http://mercurial.selenic.com/wiki/PublishingRepositories]
loading