我有以下配置/etc/xinetd.d/git
# description: The git server offers access to git repositories
service git
{
disable = no
type = UNLISTED
port = 9418
socket_type = stream
wait = no
user = nobody
server = /usr/bin/git
server_args = daemon --inetd --export-all --base-path=/home/git
log_on_failure += USERID
}
当我去克隆存储库时,git clone git://10.1.1.10/cabinet_labels.git
日志显示它引用了错误的基本路径。
2016-05-12_18:25:17.21483 git-daemon starting.
2016-05-12_18:25:17.33264 [403] Ready to rumble
2016-05-12_18:26:33.45470 [976] Connection from 10.1.1.8:56960
2016-05-12_18:26:33.45485 [976] Extended attributes (16 bytes) exist <host=10.1.1.10>
2016-05-12_18:26:33.45514 [976] Request upload-pack for '/cabinet_labels.git'
2016-05-12_18:26:33.45525 [976] '/var/lib/cabinet_labels.git' does not appear to be a git repository
2016-05-12_18:26:33.45618 [403] [976] Disconnected (with error)
有人可以告诉我我在这里缺少什么吗?
答案1
要编辑的正确配置文件是/etc/sv/git-daemon/run
,更改--base-path=/var/lib
为--base-path=/home/git
和/var/lib/git
/home/git
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugitdaemon \
"$(git --exec-path)"/git-daemon --verbose --reuseaddr \
--export-all --base-path=/home/git /home/git