(一)gitblit安装教程

您所在的位置:网站首页 gitblit官网 (一)gitblit安装教程

(一)gitblit安装教程

2024-03-06 08:31| 来源: 网络整理| 查看: 265

(一)gitblit安装教程 (二) gitblit用户使用教程 (三) gitblit管理员手册

目录 前言安装1.下载Java Runtime Requirement 2.设置环境变量3.gitblit内容3.1 gitblit文件夹内容3.2 defaults.properties 主要配置选项 4 配置4.1 准备文件4.2 修改gitblit.properties4.3 修改authority.sh4.4 修改gitblit.sh 5.生成SSL证书5.1`new certificate defaults`对话框5.2 password 对话框5.3 生成SSL证书 6.部署到阿里云服务器ubuntu上. 设置成服务运行1.修改脚本service-ubuntu.sh2.安装gitblit服务3.运行gitblit服务4.卸载

前言

gitblit和gitlab一样都是git仓库服务器,集中托管仓库.

gitlab一般大公司使用,功能全面,但是配置复杂,一般需要专门人员维护.gitblit在小公司使用,配置比较方便.

另外gitlab需要域名才能使用https,而gitblit使用https不需要申请域名,由于在阿里云上搭建git服务器,出于安全考虑使用https.

考虑简单方便,没有专门人员维护,和安全问题,暂时使用gitblit作为git服务器.

阿里云上ECS使用ubuntu20.04作为平台, 由于没有桌面,不能进行授权(authority)操作,需要先在本地linux桌面平台上进行授权操作,然后把本地的安装复制到阿里云ECS服务器上.

安装 1.下载

gitblit官网http://www.gitblit.com/, 下载Download Gitblit GO (Linux/OSX)版本.

Java Runtime Requirement

Gitblit requires a Java 7 Runtime Environment (JRE) or a Java 7 Development Kit (JDK).

如上摘录官网,gitblit需要java支持,到oracle官网下载jdk-8u381-linux-x64.tar.gz,[https://www.oracle.com/java/technologies/downloads/](https://www.oracle.com/java/technologies/downloads/

把gitblt和java安装包复制到本地ubuntu或ubuntu虚拟机中.

. ├── gitblit-1.9.3.tar.gz └── jdk-8u381-linux-x64.tar.gz

解压文件

tar -zxf jdk-8u381-linux-x64.tar.gz tar -zxf gitblit-1.9.3.tar.gz

生成如下目录

/home/bin/ ├── gitblit-1.9.3 └── jdk1.8.0_381 2.设置环境变量

设置环境变量

vim ~/.bashrc

export JAVA_HOME=/home/bin/jdk1.8.0_381 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:${JRE_HOME}/lib/security export PATH=${JAVA_HOME}/bin:$PATH

使环境变量有效 source ~/.bashrc

检查java jdk是否安装成功

java -version javac -version

显示版本信息说明安装成功

3.gitblit内容

按照如下导航可以查看安装步骤 在这里插入图片描述接下来的配置和安装都是参考这个文档.

3.1 gitblit文件夹内容 . ├── add-indexed-branch.sh ├── authority.sh ├── data ├── docs ├── ext ├── gitblit.jar ├── gitblit.sh ├── gitblit-stop.sh ├── install-service-centos.sh ├── install-service-fedora.sh ├── install-service-freebsd.sh ├── install-service-ubuntu.sh ├── java-proxy-config.sh ├── LICENSE ├── migrate-tickets.sh ├── NOTICE ├── reindex-tickets.sh ├── service-centos.sh ├── service-freebsd.sh └── service-ubuntu.sh

比较重要的文件和文件夹是:authority.sh,gitblit.sh,data/

authority.sh内容

#!/bin/bash java -cp "gitblit.jar:ext/*" com.gitblit.authority.GitblitAuthority --baseFolder data

gitblit.sh

#!/bin/bash java -cp "gitblit.jar:ext/*" com.gitblit.GitBlitServer --baseFolder data

data/文件夹内容

data/ ├── certs ├── defaults.properties ├── git ├── gitblit.properties ├── gitignore ├── groovy ├── projects.conf └── users.conf

gitblit.properties `

# # 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 # # Define your overrides or custom settings below #

可见gitblit.properties调用defaults.properties.

3.2 defaults.properties 主要配置选项 # 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 = ${baseFolder}/git # Location of Groovy scripts to use for Pre and Post receive hooks. # Use forward slashes even on Windows!! # e.g. c:/groovy # # RESTART REQUIRED # SINCE 0.8.0 # BASEFOLDER groovy.scriptsFolder = ${baseFolder}/groovy # Specify the directory Grape uses for downloading libraries. # http://groovy.codehaus.org/Grape # # RESTART REQUIRED # SINCE 1.0.0 # BASEFOLDER groovy.grapeFolder = ${baseFolder}/groovy/grape # Either the full path to a user config file (users.conf) # OR a fully qualified class name that implements the IUserService interface. # # Any custom user service implementation must have a public default constructor. # # SINCE 0.5.0 # RESTART REQUIRED # BASEFOLDER realm.userService = ${baseFolder}/users.conf # You may specify a different logo image for the header but it must be 120x45px. # If the specified file does not exist, the default Gitblit logo will be used. # # SINCE 1.3.0 # BASEFOLDER web.headerLogo = ${baseFolder}/logo.png # Enforce date checks on client certificates to ensure that they are not being # used prematurely and that they have not expired. # # SINCE 1.2.0 git.enforceCertificateValidity = true # Specify the list of acceptable transports for pushes. # If this setting is empty, all transports are acceptable. # # Valid choices are: GIT HTTP HTTPS SSH # # SINCE 1.5.0 # SPACE-DELIMITED git.acceptedPushTransports = HTTP HTTPS SSH # Allow an authenticated user to create a destination repository on a push if # the repository does not already exist. # # Administrator accounts can create a repository in any project. # These repositories are created with the default access restriction and authorization # control values. The pushing account is set as the owner. # # Non-administrator accounts with the CREATE role may create personal repositories. # These repositories are created as VIEW restricted for NAMED users. # The pushing account is set as the owner. # # SINCE 1.2.0 git.allowCreateOnPush = true # Require admin authentication for the admin functions and pages # # SINCE 0.5.0 # RESTART REQUIRED web.authenticateAdminPages = true # Allow deletion of non-empty repositories. This is enforced for all delete vectors. # # SINCE 1.6.0 web.allowDeletingNonEmptyRepositories = true # # Gitblit Web Settings # # If blank Gitblit is displayed. # # SINCE 0.5.0 web.siteName = # Standard http port to serve.


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3