一. 安裝java
下載地址:http://www.java.com/zh_CN/
如果不會安裝,請自行百度過程.
二. 配置java環(huán)境變量
右鍵”計(jì)算機(jī)” => ”屬性” => ”高級系統(tǒng)設(shè)置” => ”高級” => “環(huán)境變量” => “系統(tǒng)變量”墓懂。
- 新建:變量名:JAVA_HOME
變量值:C:\Program Files\Java\jre1.8【具體要根據(jù)你自己的安裝路徑】 - 新建變量名:CLASSPATH
變量值:%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar - 添加
找到PATH變量,選擇編輯兜蠕。把%JAVA_HOME%/bin;%JAVA_HOME%/jre/bin添加到”變量值”的結(jié)尾處。
三. 搭建Gitblit服務(wù)器
- 下載地址:http://gitblit.com/
- 解壓縮下載的壓縮包即可毕匀,無需安裝翁潘。我的保存位置為
D:\develop\GitServer\gitblit-1.8.0
- 創(chuàng)建一個(gè)目錄,用來存放代碼庫
D:\develop\GitServer\gitdata
- 修改data目錄下的gitblit.properties
D:\develop\GitServer\gitblit-1.8.0\data\gitblit.properties
可以從同目錄下defaults.properties文件中拷貝過來的,追加上內(nèi)容之下,并進(jìn)行如下內(nèi)容部分的修改:
# Base folder for repositories.
# This folder may contain bare and non-bare repositories but Gitblit will only
# allow you to push to bare repositories.
# Use forward slashes even on Windows!!
# e.g. c:/gitrepos
#
# SINCE 0.5.0
# RESTART REQUIRED
# BASEFOLDER
#修改代碼庫存放路徑
git.repositoriesFolder = D:\develop\GitServer\gitdata
# Standard http port to serve. <= 0 disables this connector.
# On Unix/Linux systems, ports < 1024 require root permissions.
# Recommended value: 80 or 8080
#
# SINCE 0.5.0
# RESTART REQUIRED
#設(shè)定http協(xié)議端口號
server.httpPort = 10101
# Secure/SSL https port to serve. <= 0 disables this connector.
# On Unix/Linux systems, ports < 1024 require root permissions.
# Recommended value: 443 or 8443
#
# SINCE 0.5.0
# RESTART REQUIRED
#設(shè)定https協(xié)議端口號
server.httpsPort = 8443
# Specify the interface for Jetty to bind the standard connector.
# You may specify an ip or an empty value to bind to all interfaces.
# Specifying localhost will result in Gitblit ONLY listening to requests to
# localhost.
#
# SINCE 0.5.0
# RESTART REQUIRED
#設(shè)定服務(wù)器的ip地址,本地搭建,這里要寫自己本地的ip地址
server.httpBindInterface =10.52.22.124
# Specify the interface for Jetty to bind the secure connector.
# You may specify an ip or an empty value to bind to all interfaces.
# Specifying localhost will result in Gitblit ONLY listening to requests to
# localhost.
#
# SINCE 0.5.0
# RESTART REQUIRED
server.httpsBindInterface =localhost
- 修改installService.cmd D:\develop\GitServer\gitblit-1.8.0\installService.cmd
@REM arch = x86, amd64, or ia32
SET ARCH=x86
32位系統(tǒng):SET ARCH=x86
64位系統(tǒng):SET ARCH=amd64
我的電腦是64位的,我照樣選擇的x86,沒有問題,你可以適當(dāng)調(diào)整設(shè)置.
- 以Windows Service方式啟動(dòng)Gitblit.
說明:啟動(dòng)過程中,如果不成功,可以查看D:\develop\GitServer\gitblit-1.8.0\logs
中的日志文件,查看日志信息,根據(jù)日志定位問題.
(1) 鼠標(biāo)右擊Gitblit目錄下的installService.cmd文件,以管理員身份運(yùn)行涡尘。
(2) 鼠標(biāo)右擊Gitblit目錄下的gitblitw.exe文件,以管理員身份運(yùn)行.
運(yùn)行之前,建議做如下圖的設(shè)置變更:
成功啟動(dòng)后的效果如下圖:
(3) 檢查windows服務(wù),搜索
services.msc
如果未啟動(dòng)的話,也可以在這里手動(dòng)啟動(dòng).注意確保為自動(dòng)模式忍弛,每次windows啟動(dòng)都自動(dòng)啟動(dòng)
四. 登錄
- 瀏覽器訪問:http://10.52.22.124:10101 依據(jù)gitblit.properties中的配置
成功 - 用管理員賬號登陸 用戶名/密碼 admin/admin