LoginSignup
9

More than 5 years have passed since last update.

Windows8マシンを社内gitサーバにする

Posted at

はじめに

Windows8マシンをプライベートなgitサーバにする方法です。

無料で、10〜20人程度が使う、社内プライベートなgitサーバが必要でした。
丁度良くSubversionをホストしていたWindows8マシンが1台あったので、それをgitサーバに変身させました。

ソフトウェアは、調査検討した結果「Gitblit」に落ち着きました。
1年間以上運用していますがトラブルなく使用できています。

Unix系ではなくWindowsでgitをホストしたいんだ!という方の参考になりましたら幸いです。

JREのインストール

バージョン7以降が必須です。
こちらからダウンロードしインストールします。

32bit版と64bit版があることに気を付けましょう。
動かしているOSのbit数に合わせます。

Gitblit GO のダウンロードとインストール

こちらより「Gitblit GO」をダウンロードします。

展開してC:¥直下にgitblitフォルダを作り中身を配置。
パスにスペースが無い方が良いようです。

data/gitblit.propertiesの編集

propertiesファイルを2行編集します。

gitblit.properties
(前後略)
server.httpPort 任意のポート:(例) 8050
(中略)
server.storePassword 任意のパスワード

gitblit.cmd実行

コマンドラインよりgitblit.cmdを実行します。
開始をしばし待ちましょう。

ブラウザで動作確認

http://localhost:8050 (例)

Gitblitの画面が表示されたら成功です。
admin / adminでログインしてください。

サービス化

サービス化することでWindowsを再起動しても自動で立ち上がってくれます。

installService.cmd内容確認と実行

ARCH、StartParamsの内容を確認します。

installService.cmd
@REM Install Gitblit as a Windows service.

@REM gitblitw.exe (prunmgr.exe) is a GUI application for monitoring 
@REM and configuring the Gitblit procrun service.
@REM
@REM By default this tool launches the service properties dialog
@REM but it also has some other very useful functionality.
@REM
@REM http://commons.apache.org/daemon/procrun.html

@REM arch = x86, amd64, or ia32
SET ARCH=amd64

@REM Be careful not to introduce trailing whitespace after the ^ characters.
@REM Use ; or # to separate values in the --StartParams parameter.
"%CD%\%ARCH%\gitblit.exe"  //IS//gitblit ^
         --DisplayName="gitblit" ^
         --Description="a pure Java Git solution" ^
         --Startup=auto ^
         --LogPath="%CD%\logs" ^
         --LogLevel=INFO ^
         --LogPrefix=gitblit ^
         --StdOutput=auto ^
         --StdError=auto ^
         --StartPath="%CD%" ^
         --StartClass=org.moxie.MxLauncher ^
         --StartMethod=main ^
         --StartParams="--storePassword;gitblit;--baseFolder;%CD%\data" ^
         --StartMode=jvm ^
         --StopPath="%CD%" ^
         --StopClass=org.moxie.MxLauncher ^
         --StopMethod=main ^
         --StopParams="--stop;--baseFolder;%CD%\data" ^
         --StopMode=jvm ^
         --Classpath="%CD%\gitblit.jar" ^
         --Jvm=auto ^
         --JvmMx=1024

コマンドラインよりinstallService.cmdを実行します。

サービス一覧より確認すると
gitblitのサービスが追加されています。

C:\gitblit\amd64\gitblit.exe //RS//gitblit

※サービス化のあたりの記録と記憶が少し曖昧です。
動作しなかったら申し訳ないです。

おわりに

https化の内容は省略しています。

2014/12現在では、GitBucketも良さそうです。

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
9