shuaiwei588 发表于 2018-9-18 10:07:47

git-daemon更改base-path

  centos中,git-daemon是独立的包。
  yum install git-daemon
  默认的/etc/xinet.d/git为
  service git
  {
  disable         = no
  socket_type   = stream
  wait            = no
  user            = nobody
  server          = /usr/libexec/git-core/git-daemon
  server_args   = --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose
  log_on_failure+= USERID
  }
  根据配置,把相应的库clone到base-path位置,可以正常工作。
  虽然我安装的git默认版本库路径为/home/git/repositories(即git用户的家目录为/home/git),但建议不要采用该路径。这样任何人都能看到你repositories下的所有版本库,包括gitosis-admin.git。而且直接把base-path改成如下:
  service git
  {
  disable         = no
  socket_type   = stream
  wait            = no
  user            = nobody
  server          = /usr/libexec/git-core/git-daemon
  server_args   = --base-path=/home/git/repositories --export-all --user-path=public_git --syslog --inetd --verbose
  log_on_failure+= USERID
  }
  会出现莫名的错误:
  /var/log/messages:
  May 23 10:32:48 localhost git-daemon: base-path '/home/git/repositories/' does not exist or is not a directory
  May 23 10:32:48 localhost xinetd: EXIT: git status=1 pid=4746 duration=0(sec)
  但是直接将配置中的语句拿到命令行执行没有问题。
  非要这么做也是可以的。如下配置:(参考:http://bugzilla.novell.com/show_bug.cgi?id=461726)
  service git
  {
  disable         = no
  socket_type   = stream
  wait            = no
  user            = nobody
  server          = /usr/bin/git
  server_args   = daemon --reuseaddr --base-path=/home/git/repositories --export-all --user-path=public_git --syslog --inetd --verbose
  log_on_failure+= USERID
  }
  Finally, When clone a repository, having suffix .git or not makes big different. Please make it precise.
  like
  git clone git://lbc.com/mysite.git
  git clone git://lbc.com/mysite

页: [1]
查看完整版本: git-daemon更改base-path