git push すると "fatal: remote error: access denied or repository not exported: ..." が表示される

問題

Git daemon をセットアップ後、そこから git clone したリポジトリーを git push すると次のエラーメッセージが表示される。

fatal: remote error: access denied or repository not exported: /path/to/sample.git
環境
原因
  • Git daemon の receive-pack サービスが有効になっていないため。
解決方法

Git daemon の receive-pack サービスを有効にする。

テキストエディターで git-daemon の起動スクリプトを開く。

# vi  /etc/sv/git-daemon/run

起動オプションに --enable=receive-pack を追加する。

 #!/bin/sh
 exec 2>&1
 echo 'git-daemon starting.'
 exec chpst -ugitdaemon \
   "$(git --exec-path)"/git-daemon --verbose --export-all --reuseaddr \
-    --base-path=/var/lib /var/lib/git
+    --base-path=/var/lib --enable=receive-pack /var/lib/git

git-daemon を再起動する。

# sv  restart  git-daemon
参考にしたページ