Gitblit是一款开源、纯Java开发的用于管理、浏览和提供Git仓库服务的软件。它被设计成一款为希望托管中心仓库的小型工作组服务的工具。
说明: 安装Gitblit需要安装在linux中安装JDK,我安装的是JDK1.8, Gitblit在JDK1.6有可能报错, 安装Gitblit不需要安装Git, 本机没有安装Git可以使用
参考1
官网下载地址(http://www.gitblit.com/)
下载 gitblit-1.8.0.tar.gz
tar -zvxf gitblit-1.8.0.tar.gz
我将安装包上传在服务器的/usr/local下
[root@VM_0_11_centos local]# ls
apache-tomcat-8.5.29 bin games gitblit-1.8.0.tar.gz jdk-8u161-linux-x64.rpm lib64 mysql nginx nginx-1.14.0.tar.gz sbin src
apache-tomcat-8.5.29.tar.gz etc gitblit-1.8.0 include lib libexec mysql-5.5.59-linux-glibc2.12-x86_64.tar.gz nginx-1.14.0 qcloud share upload
[root@VM_0_11_centos local]# tar -zvxf gitblit-1.8.0.tar.gz
gitblit-1.8.0/add-indexed-branch.sh
gitblit-1.8.0/authority.sh
gitblit-1.8.0/gitblit-stop.sh
gitblit-1.8.0/gitblit.sh
gitblit-1.8.0/install-service-centos.sh
gitblit-1.8.0/install-service-fedora.sh
3.1 进入解压目录gitblit-1.8.0的data文件夹
[root@VM_0_11_centos local]# cd /usr/local/gitblit-1.8.0/data/
[root@VM_0_11_centos data]# ls
certs git gitignore lfs plugins serverKeyStore.jks ssh-dsa-hostkey.pem temp users.conf
defaults.properties gitblit.properties groovy logs projects.conf serverTrustStore.jks ssh-rsa-hostkey.pem tickets
[root@VM_0_11_centos data]#
3.2 配置gitblit.properties文件
[root@VM_0_11_centos data]# vim gitblit.properties
在gitblit.properties文件中添加下面三行
# 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
web.enableRpcManagement = true
server.httpPort = 7070
server.httpsPort = 7071
#
3.3 修改service-centos.sh中的参数路径,改为自己gitblit所在的目录路径
[root@VM_0_11_centos gitblit-1.8.0]# cd /usr/local/gitblit-1.8.0/
[root@VM_0_11_centos gitblit-1.8.0]# ls
add-indexed-branch.sh data ext gitblit.sh install-service-centos.sh install-service-ubuntu.sh LICENSE NOTICE service-centos.sh
authority.sh docs gitblit.jar gitblit-stop.sh install-service-fedora.sh java-proxy-config.sh migrate-tickets.sh reindex-tickets.sh service-ubuntu.sh
[root@VM_0_11_centos gitblit-1.8.0]# vim service-centos.sh
# change theses values (default values)
GITBLIT_PATH=/usr/local/gitblit-1.8.0
GITBLIT_BASE_FOLDER=/usr/local/gitblit-1.8.0/data
GITBLIT_HTTP_PORT=7070
GITBLIT_HTTPS_PORT=7071
GITBLIT_LOG=/usr/local/gitblit-1.8.0/gitblit.log
source ${GITBLIT_PATH}/java-proxy-config.sh
4.1 进入解压目录 /usr/local/gitblit-1.8.0/
[root@VM_0_11_centos gitblit-1.8.0]# cd /usr/local/gitblit-1.8.0/
[root@VM_0_11_centos gitblit-1.8.0]# ls
add-indexed-branch.sh data ext gitblit.sh install-service-centos.sh install-service-ubuntu.sh LICENSE NOTICE service-centos.sh
authority.sh docs gitblit.jar gitblit-stop.sh install-service-fedora.sh java-proxy-config.sh migrate-tickets.sh reindex-tickets.sh service-ubuntu.sh
[root@VM_0_11_centos gitblit-1.8.0]# java -jar gitblit.jar --baseFolder data
4.2 运行gitblit.jar
[root@VM_0_11_centos gitblit-1.8.0]# java -jar gitblit.jar --baseFolder data
2018-10-31 12:51:23 [INFO ]
_____ _ _ _ _ _ _
| __ \(_)| | | | | |(_)| |
| | \/ _ | |_ | |__ | | _ | |_
| | __ | || __|| '_ \ | || || __| http://gitblit.com
| |_\ \| || |_ | |_) || || || |_ @gitblit
\____/|_| \__||_.__/ |_||_| \__| 1.8.0
2018-10-31 12:51:23 [INFO ] Running on Linux (3.10.0-693.el7.x86_64)
2018-10-31 12:51:23 [INFO ] Logging initialized @871ms
2018-10-31 12:51:23 [INFO ] Using JCE Unlimited Strength Jurisdiction Policy files
2018-10-31 12:51:23 [INFO ] Setting up HTTPS transport on port 7071
2018-10-31 12:51:23 [INFO ] certificate alias = localhost
.
.
.
注意: 上面运行方式, 在退出窗口后, 服务跟随停止
查看jar包运行状态
[root@VM_0_11_centos gitblit-1.8.0]# ps aux|grep gitblit.jar
root 3285 0.0 0.0 112704 988 pts/3 R+ 12:52 0:00 grep --color=auto gitblit.jar
[root@VM_0_11_centos gitblit-1.8.0]#
采用nohup java -jar xxx.jar >/dev/null 2>&1 &
root 3285 0.0 0.0 112704 988 pts/3 R+ 12:52 0:00 grep --color=auto gitblit.jar
[root@VM_0_11_centos gitblit-1.8.0]# nohup java -jar gitblit.jar >/dev/null 2>&1 &
[1] 3340
[root@VM_0_11_centos gitblit-1.8.0]# ps aux|grep gitblit.jar
root 3340 76.3 4.7 2509124 89332 pts/3 Sl 12:53 0:04 java -jar gitblit.jar
root 3369 0.0 0.0 112704 988 pts/3 R+ 12:53 0:00 grep --color=auto gitblit.jar
[root@VM_0_11_centos gitblit-1.8.0]#