(一)gitblit安装教程

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

目录

  • 前言
  • 安装
    • 1.下载
      • Java Runtime Requirement
    • 2.设置环境变量
    • 3.gitblit内容
      • 3.1 gitblit文件夹内容
      • 3.2 defaults.properties 主要配置选项
    • 4 配置
      • 4.1 准备文件
      • 4.2 修改gitblit.properties
      • 4.3 修改authority.sh
      • 4.4 修改gitblit.sh
    • 5.生成SSL证书
      • 5.1`new certificate defaults`对话框
      • 5.2 password 对话框
      • 5.3 生成SSL证书
    • 6.部署到阿里云服务器ubuntu上.
  • 设置成服务运行
    • 1.修改脚本service-ubuntu.sh
    • 2.安装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.  <= 0 disables this connector.
# On Unix/Linux systems, ports < 1024 require root permissions.
# Recommended value: 80 or 8080
#
# SINCE 0.5.0
# RESTART REQUIRED
server.httpPort = 0# 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
server.httpBindInterface =# 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
server.httpsPort = 8443# 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 =# Alias of certificate to use for https/SSL serving.  If blank the first
# certificate found in the keystore will be used. 
#
# SINCE 1.2.0
# RESTART REQUIRED
server.certificateAlias = localhost# Password for SSL keystore.
# Keystore password and certificate password must match.
# This is provided for convenience, its probably more secure to set this value
# using the --storePassword command line parameter.
#
# If you are using the official JRE or JDK from Oracle you may not have the
# JCE Unlimited Strength Jurisdiction Policy files bundled with your JVM.  Because
# of this, your store/key password can not exceed 7 characters.  If you require
# longer passwords you may need to install the JCE Unlimited Strength Jurisdiction
# Policy files from Oracle.
#
# http://www.oracle.com/technetwork/java/javase/downloads/index.html
#
# Gitblit and the Gitblit Certificate Authority will both indicate if Unlimited
# Strength encryption is available.
#
# SINCE 0.5.0
# RESTART REQUIRED
server.storePassword = gitblit

4 配置

配置目标:

  1. 把配置信息和git仓库放在数据盘中,并且分别存放,方便维护用户信息和git仓库.
  2. 只使用开启https访问
  3. git仓库访问支持所有方式,例如https,git,ssh等.

4.1 准备文件

mkdir -p /data/gitblit/
cp -ravf /home/bin/gitblit-1.9.3/data/ /data/gitblit/
cd /data/gitblit/data
mv git ../

4.2 修改gitblit.properties

vim /data/gitblit/data/gitblit.properties

git.acceptedPushTransports =
web.siteName =
git.repositoriesFolder = ${baseFolder}/../git
web.allowDeletingNonEmptyRepositories = false

4.3 修改authority.sh

vim /home/bin/gitblit-1.9.3/authority.sh

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

4.4 修改gitblit.sh

vim /home/bin/gitblit-1.9.3/gitblit.sh

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

5.生成SSL证书

一定要在ubuntu内部运行命令,不能使用ssh远程访问.

cd /home/bin/gitblit-1.9.3
./authority.sh

5.1new certificate defaults对话框

在这里插入图片描述
validity中输入36500天,按OK按钮

5.2 password 对话框

在这里插入图片描述

输入server.storePassword对于的密码,按OK按钮.

5.3 生成SSL证书

在这里插入图片描述
如图点击红色按钮,弹出如下对话框
在这里插入图片描述
hostname: 输入阿里云公网IP地址

expires:设置有效日期

serve https with this certificate:确定选上.

点击OK,提示生成SSL证书
在这里插入图片描述

6.部署到阿里云服务器ubuntu上.

.bashrc,jdk,gitblit和gitblit配置文件全部复制到服务器上即可.

设置成服务运行

需要把gitblit设置成守护进程运行,不然关闭远程连接控制台gitblit就会停止.

1.修改脚本service-ubuntu.sh

#1.设置用户信息目录
GITBLIT_BASE_FOLDER=/data/gitblit/data#2.设置java,使用deb包安装不需要java设置
#在PATH=/sbin:/bin:/usr/bin:/usr/sbin后面增加
JAVA_HOME=/home/bin/jdk1.8.0_381
JRE_HOME=${JAVA_HOME}/jre
CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:${JRE_HOME}/lib/security
PATH=${JAVA_HOME}/bin:$PATH#3./usr/bin/java 替换成 你安装 java 绝对路径 ${JAVA_HOME}/bin/java#4.设置gitblit应用程序目录
GITBLIT_PATH=/home/bin/gitblit-1.9.3#5.修改用户
#也可以保持gitblit用户,需要使用useradd或者adduser工具建立这个用户.
GITBLIT_USER="root"

2.安装gitblit服务

./install-service-ubuntu.sh

3.运行gitblit服务

sudo service gitblit restart
#查看运行状态
sudo service gitblit status

4.卸载

#停止服务
sudo service gitblit stop#卸载服务
cd /etc/init.d/
sudo rm gitblit 
sudo update-rc.d gitblit remove#删除gitblit应用程序
rm -rvf /home/bin/gitblit-1.9.3
#删除gitblit配置文件和git库
rm -rvf /data/gitblit

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/91265.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于自适应启动策略的混合交叉动态约束多目标优化算法(MC-DCMOEA)求解CEC2015/CEC2018/CEC2023(MATLAB代码)

一、动态多目标优化问题 1.1问题定义 1.2 动态支配关系定义 二、 基于自适应启动策略的混合交叉动态多目标优化算法 基于自适应启动策略的混合交叉动态多目标优化算法&#xff08;Mixture Crossover Dynamic Constrained Multi-objective Evolutionary Algorithm Based on Se…

试图一文彻底讲清 “精准测试”

在软件测试中&#xff0c;我们常常碰到两个基本问题&#xff08;困难&#xff09;&#xff1a; 很难保障无漏测&#xff1a;我们做了大量测试&#xff0c;但不清楚测得怎样&#xff0c;对软件上线后会不会出问题&#xff0c;没有信心&#xff1b; 选择待执行的测试用例&#…

跨类型文本文件,反序列化与类型转换的思考

文章目录 应用场景序列化 - 对象替换原内容&#xff0c;方便使用编写程序取得结果数组 序列化 - JSON 应用场景 在编写热更新的时候&#xff0c;我发现了一个古早的 ini 文件&#xff0c;记录了许多有用的数据 由于使用的语言年份较新&#xff0c;没有办法较好地对 ini 文件的…

map和set的具体用法 【C++】

文章目录 关联式容器键值对setset的定义方式set的使用 multisetmapmap的定义方式insertfinderase[]运算符重载map的迭代器遍历 multimap 关联式容器 关联式容器里面存储的是<key, value>结构的键值对&#xff0c;在数据检索时比序列式容器效率更高。比如&#xff1a;set…

ARP欺骗攻击实操

目录 目录 前言 系列文章列表 全文导图 1&#xff0c;ARP概述 1.1,ARP是什么&#xff1f; 1.2,ARP协议的基本功能 1.3,ARP缓存表 1.4,ARP常用命令 2&#xff0c;ARP欺骗 2.1,ARP欺骗的概述? 2.2,ARP欺骗的攻击手法 3&#xff0c;ARP攻击 3.1,攻击前的准备 3.2,…

【Spring Boot】实战:实现数据缓存框架

🌿欢迎来到@衍生星球的CSDN博文🌿 🍁本文主要学习【Spring Boot】实现数据缓存框架 🍁 🌱我是衍生星球,一个从事集成开发的打工人🌱 ⭐️喜欢的朋友可以关注一下🫰🫰🫰,下次更新不迷路⭐️💠作为一名热衷于分享知识的程序员,我乐于在CSDN上与广大开发者…

Python3 如何实现 websocket 服务?

Python 实现 websocket 服务很简单&#xff0c;有很多的三方包可以用&#xff0c;我从网上大概找到三种常用的包&#xff1a;websocket、websockets、Flask-Sockets。 但这些包很多都“年久失修”&#xff0c; 比如 websocket 在 2010 年就不维护了。 而 Flask-Sockets 也在 2…

SQL血缘解析原理

根据sql解析获取到表到表, 字段到字段间的关系,即血缘关系。实际上这是从sql文本获取到数据流的过程。 大致步骤如下&#xff1a; 1.sql文本进行词法分析 2.sql语法分析获取到AST抽象语法树 3.访问AST抽象语法树根据语法结构推测出数据的流向,例如create as select from 这种结…

[vue-admin-template实战笔记]

1.克隆项目 git clone gitgitee.com:panjiachen/vue-admin-template.git 2.安装依赖 npm install 3.运行项目就会自动打开网页&#xff0c;并且热部署插件 npm run dev 4.查看代码 //将vue-admin-template拖入到idea中即可查看代码 1)并且发现&#xff0c;常用的东西已经集…

Machine Learning(study notes)

There is no studying without going crazy Studying alwats drives us crazy 文章目录 DefineMachine LearningSupervised Learning&#xff08;监督学习&#xff09;Regression problemClassidication Unspervised LearningClustering StudyModel representation&#xff08…

unity 鼠标标记 左键长按生成标记右键长按清除标记,对象转化为子物体

linerender的标记参考 unity linerenderer在Game窗口中任意画线_游戏内编辑linerender-CSDN博客 让生成的标记转化为ARMarks游戏对象的子物体 LineMark.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public class LineMark : MonoBeh…

excel筛选后求和

需要对excel先筛选&#xff0c;后对“完成数量”进行求和。初始表格如下&#xff1a; 一、选中表内任意单元格&#xff0c;按ctrlshiftL&#xff0c;开启筛选 二、根据“部门”筛选&#xff0c;比如选择“一班” 筛选完毕后&#xff0c;选中上图单元格&#xff0c;然后按alt后&…

JavaScript Web APIs第一天笔记

复习&#xff1a; splice() 方法用于添加或删除数组中的元素。 **注意&#xff1a;**这种方法会改变原始数组。 删除数组&#xff1a; splice(起始位置&#xff0c; 删除的个数) 比如&#xff1a;1 let arr [red, green, blue] arr.splice(1,1) // 删除green元素 consol…

Unity如何生成随机数(设置种子)

文章目录 随机类整数二维向量三维向量种子其他文章 随机类 我们可以使用Random类来生成一些随机数 Random类是用于生成随机数的类之一。它可以用于生成不同类型的随机数&#xff0c;如整数、浮点数和向量。 整数 我们可以使用Random.Range来生成指定范围内的随机整数或浮点数…

Windows 安装CMake

CMake 简介 CMake是一个开源的、跨平台的自动化构建系統&#xff0c;用來管理软件构建的过程。 其用途主要包括&#xff1a; 1. 跨平台编译&#xff1a;CMake支援Windows&#xff0c;Mac OS&#xff0c;Linux等多种操作系統&#xff0c;且支援多数主流编译器如GCC&#xff0…

智能合约漏洞,Dyna 事件分析

智能合约漏洞&#xff0c;Dyna 事件分析 1. 漏洞简介 https://twitter.com/BlockSecTeam/status/1628319536117153794 https://twitter.com/BeosinAlert/status/1628301635834486784 2. 相关地址或交易 攻击交易 1&#xff1a; https://bscscan.com/tx/0x7fa89d869fd1b89e…

【STL巨头】set、map、multiset、multimap的介绍及使用

set、map、multiset、multimap的介绍及使用 一、关联式容器二、键值对键值对概念定义 三、setset的介绍set的使用set的模板参数列表set的构造set的迭代器set的容量emptysize set的修改操作insertfind && erasecountlower_bound 和 upper_bound Multiset的用法 四、mapm…

inndy_echo

inndy_echo Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x8048000)32位&#xff0c;只开了NX int __cdecl __noreturn main(int argc, const char **argv, const char **envp) {char s; // [espCh…

Unity2023打包首包从78Mb到3.0Mb-震惊-我做对了什么

&#xff08;全程并没有使用AssetBundle , 历史原因&#xff0c;Resources目录还有不少资源残留&#xff09; 曾经的我在2019打包过最小包10m左右&#xff0c;后来发现到了Unity2020之后暴增到40m&#xff0c;又加上2023版本URP&#xff0c;1个Unity输出包可能至少55M 如下图…

华为智能高校出口安全解决方案(3)

本文承接&#xff1a; https://qiuhualin.blog.csdn.net/article/details/133267254?spm1001.2014.3001.5502 重点讲解华为智能高校出口安全解决方案的攻击防御&安全运维&日志审计的部署流程。 华为智能高校出口安全解决方案&#xff08;3&#xff09; 课程地址攻击防…