git-daemon в systemd: базовый путь не существует или не является каталогом

Я пытаюсь разрешить доступ к моему размещенному серверу GitLab через git propocol с использованием git-daemon . Если я запускаю git-daemon из командной строки, он работает должным образом:

$ /usr/libexec/git-core/git-daemon --export-all --base-path=/var/opt/gitlab/git-data/repositories --syslog --verbose

$ git ls-remote git://localhost/cm/test_project.git
9cbff8accfa291ffeb8189f114c6d290a3856511        HEAD
2817d289674481ef02f05c3558063a5239d844b2        refs/heads/develop2
9cbff8accfa291ffeb8189f114c6d290a3856511        refs/heads/master
bce85bd749a69cb127bdb0e64c173e926eb77cbc        refs/heads/old-master
$

Но если я запускаю git-daemon как systemd unit, я получаю следующую ошибку :

$ git ls-remote git://localhost/cm/test_project.git
fatal: read error: Connection reset by peer
$

и в журналах:

git-daemon[19089]: base-path '/var/opt/gitlab/git-data/repositories' does not exist or is not a directory

У меня следующие настройки:git-daemon @ .service:

$ cat /etc/systemd/system/git-daemon@.service
[Unit]
Description=Git Repositories Server Daemon
Documentation=man:git-daemon(1)

[Service]
User=nobody
ExecStart=-/usr/libexec/git-core/git-daemon --export-all --base-path=/var/opt/gitlab/git-data/repositories --syslog --verbose
StandardInput=socket
$

Порт 9418 доступен:

$ netstat -nap | grep 9418
tcp        0      0 0.0.0.0:9418            0.0.0.0:*               LISTEN      1/systemd
$

Каталог существует:

$ stat /var/opt/gitlab/git-data/repositories
  File: ‘/var/opt/gitlab/git-data/repositories’
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: fc01h/64513d    Inode: 226543354   Links: 46
Access: (2770/drwxrws---)  Uid: (  500/     git)   Gid: (  500/     git)
Access: 2017-06-09 13:13:16.514659543 +0000
Modify: 2017-04-22 23:28:16.227301854 +0000
Change: 2017-04-22 23:28:16.227301854 +0000
 Birth: -
$

ОС - CentOS 7 , версия git - 1.8.3.1

$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
$ git --version
git version 1.8.3.1
$

Кто угодно, пожалуйста help?

1
задан 9 June 2017 в 18:06
1 ответ

Я обнаружил, что User=nobody нужно изменить на User=git в /etc/systemd/system/git-daemon@.service, чтобы исправить проблему.

.
0
ответ дан 4 December 2019 в 04:51

Теги

Похожие вопросы