1. 程式人生 > >Gitblit環境搭建(w7 64位環境)

Gitblit環境搭建(w7 64位環境)

gitblit環境搭建(w7 64位環境)
為什麼沒用gitlab,整合的東西太多,短時間的搭建是很難的

Java環境搭建

省略,自行百度。本人Java環境是1.8.0_121

Gitblit搭建

下載地址(下載windows版本的):

http://www.gitblit.com/

下載完成後只需要解壓即可,無需安裝。
我的安裝路徑:

E:\git\gitblit-1.8.0

儲存檔案路徑:

E:\git\gitReposittory    步驟3.1會用到

1.修改gitblit.properties配置檔案(我的檔案在E:\git\gitblit-1.8.0\data目錄下面)

#
# GITBLIT.PROPERTIES
#
# Define your custom settings in this file and/or include settings defined in
# other properties files.
#

# Include Gitblit's 'defaults.properties' within your configuration.
#
# NOTE: Gitblit will not automatically reload "included" properties.  Gitblit
# only watches the 'gitblit.properties' file for modifications.
# # Paths may be relative to the ${baseFolder} or they may be absolute. # # COMMA-DELIMITED # SINCE 1.7.0 #include = defaults.properties 註釋掉 include = my.properties 新建的檔名,步驟2會建立這個檔案 # Define your overrides or custom settings below #
  1. 新增新的檔案
    複製defaults.properties,貼上,重新命名為my.properties (推薦不要直接修改檔名,留作備份比較好,萬一檔案被改壞了,還能繼續複製使用)

  2. 修改my.properties 檔案

git.repositoriesFolder = E:\git\gitReposittory
server.httpPort = 10101
server.httpBindInterface = 192.168.0.147   我的ip
server.httpsBindInterface = localhost
  1. 開啟gitblit.cmd(E:\git\gitblit-1.8.0 目錄下面)

    控制檯出現started 沒出現什麼錯誤就表示開啟了,接著開啟瀏覽器輸入http://192.168.0.147:10101 ,就可以看到網址了(中文)

以上基本的配置完成,因為是在win上的,我們可以設定以Windows Service方式啟動Gitblit 1. 修改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
SET CD=E:\git\gitblit-1.8.0   你的安裝目錄
@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="" ^     這個裡面的內容清空
         --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
  1. 右鍵,以管理員的方式開啟installService.cmd
  2. 這樣就可以類似於mysql一樣開啟服務了,當然也可以不採用
    自己寫指令碼,花式啟動各種我就不介紹了,愛怎麼玩怎麼玩

網頁的初始登入使用者名稱和密碼都是admin
其他的操作本人還在學習,有時間再更新部落格