git-daemon-run实际是一个脚本管理工具,用来启动git-daemon.
1 安装git-daemon-run(A端)
1
|
apt-
get
install git-daemon-run
|
2. 配置git-daemon-run(A端)
1
|
vi /etc/sv/git-daemon/run
|
可以看到:
1
2
3
4
5
6
|
#!/bin/sh
exec 2>&1
echo
'git-daemon starting.'
exec chpst -ugitdaemon \
"$(git --exec-path)"
/git-daemon --verbose --reuseaddr \
--
base
-path=/
var
/lib /
var
/lib/git
|
将最后一行修改为:
1
|
--export-all --enable=receive-pack --
base
-path=/home/git/repositories/
|
参数说明:
a) --export-all
使用该选项后,在git仓库中就不必创建git-daemon-export-ok文件。如果不使用该选项,则还需要创建该文件,即
1
|
touch git-daemon-export-ok
|
b) --enable=receive-pack
3. 重启git deamon(A端)
1
2
|
sudo sv stop git-daemon
sudo sv start git-daemon
|
或者:
1
|
sudo sv restart git-daemon
|