我尝试通过这个(官方)教程调整 hg:http: //dev.lshift.net/paul/mercurial-server/docbook.html
当我尝试:
sudo -u hg /usr/share/mercurial-server/refresh-auth
它说:
No section: 'paths'
Must be run as the 'hg' user
所以这是个问题
升级版:
解决方法,以及安装 mercurial-server 的真正教程:
在远程服务器上:
0) save your repos to homedir
1) <username>@<remote_server>:$ sudo apt-get purge mercurial mercurial-server
2) <username>@<remote_server>:$ sudo userdel -r hg
3) <username>@<remote_server>:$ sudo rm -r /var/lib/mercurial-server
4) <username>@<remote_server>:$ sudo rm -r /etc/mercurial-server
5) <username>@<remote_server>:$ sudo rm -r /usr/share/mercurial-server
6) <username>@<remote_server>:$ sudo apt-get install mercurial mercurial-server
7) <username>@<remote_server>:$ exit
在本地主机上:
8) ssh -A <remote_hg_server_domain>
在远程服务器上:
9) <username>@<remote_server>:$ ssh-add -L > id_rsa.pub
10) <username>@<remote_server>:$ sudo mkdir -p /etc/mercurial-server/keys/root/<username>
11) <username>@<remote_server>:$ sudo cp my-key /etc/mercurial-server/keys/root/<username>/localhost (if you work from local terminal)
12) <username>@<remote_server>:$ sudo -u hg /usr/share/mercurial-server/refresh-auth - OOPS
我们得到
Traceback (most recent call last):
File "/usr/share/mercurial-server/refresh-auth", line 22, in <module>
refreshauth.refreshAuth()
File "/usr/share/mercurial-server/mercurialserver/refreshauth.py", line 49, in refreshAuth
kf = open(ffn)
IOError: [Errno 13] Permission denied: '/etc/mercurial-server/keys/root/<username>/localhost'
解决:
13) <username>@<remote_server>:$ sudo chmod 644 /etc/mercurial-server/keys/root/<username>/localhost
14) <username>@<remote_server>:$ sudo -u hg /usr/share/mercurial-server/refresh-auth
15) <username>@<remote_server>:$ sudo chmod 600 /etc/mercurial-server/keys/root/<username>/localhost
效果很好