1
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Windows][git] gitデーモンをサービスとして動かす

Last updated at Posted at 2016-12-06

Windowsでgitデーモンを動かし、git://プロトコルでアクセスできるようにする手順です。

クライアントがWindowsだけならば、ファイル共有へレポジトリを作ればよいのですが、Windows以外もいるのでこんな手順にしました。

準備

Chocolateyをインストールする

いろいろ簡単にインストールするために、Chocolateyをインストールします。

Git for Windowsとnssmをインストールする

gitとnssmをインストールします。

nssmは任意のexeをサービス化できるツールです。

C:\> choco install git nssm

gitデーモンを動かす手順

手順 1 レポジトリ置き場を作る

公開するレポジトリを置くディレクトリを作成します。

C:\> mkdir h:\export\repos

手順 2 gitデーモンをサービスとして登録する

C:\>nssm install git-daemon "c:\Program Files\Git\cmd\git.exe" "daemon --export-all --enable=receive-pack --base-path=h:\export\repos"

手順 3 ファイアウォールでポートを開放する

TCP 9418番ポートを開放してアクセスできるようにします。

レポジトリを作成する手順

レポジトリに書き込みできるようにするためには、ちょっとひと手間必要です。

レポジトリを作成

これはいつもどおりです。

C:\> git init --bare h:\export\repos\test.git

空ファイルを作成

このファイルがないとpushできないです。

C:\> echo > h:\export\repos\test.git\git-daemon-export-ok
1
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?