(一)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.hqwc.cn/news/125009.html

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

相关文章

zookeeper mac安装

目录 1.下载zookeeper安装包 2.解压安装包 3.修改配置文件 4.启动服务端 5.启动客户端 这边工作中用到了zookeeper组件&#xff0c;但自己独立安装弄的不太多&#xff0c;这边本机mac装一个做测试使用 以下是安装记录&#xff0c;可以作为参考 从以下链接zookeeper版本列…

【成像光敏描记图提取和处理】成像-光电容积描记-提取-脉搏率-估计(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

Flutter笔记:手写并发布一个人机滑动验证码插件

Flutter笔记 手写一个人机滑块验证码 作者&#xff1a;李俊才 &#xff08;jcLee95&#xff09;&#xff1a;https://blog.csdn.net/qq_28550263 邮箱 &#xff1a;291148484163.com 本文地址&#xff1a;https://blog.csdn.net/qq_28550263/article/details/133529459 写 Flut…

System Generator初体验FIR滤波器

文章目录 前言一、介绍1、目标2、过程 二、步骤 1&#xff1a;在 FPGA 中创建设计1、打开 Lab1_1.slx 文件2、运行仿真3、使用 System Generator 创建 FIR 滤波器<1>、从库浏览器寻找需要的模块<2>、配置系统生成器块<3>、在 FPGA 上实现设计 三、步骤 2&…

线程的详解

创建状态 就绪状态 阻塞状态 运行状态 死亡状态 常用方法 setPriority(ing newPriority) 更改线程的优先级 sleep(long millis) 在指定的毫秒数内让当前正在执行的线程休眠 join() 等待该线程终止 yield() 暂停当前正在执行的线程对象&#xff0c;并执行其他线程 inte…

【Linux进行时】进程地址空间

进程地址空间 例子引入&#xff1a; 我们在讲C语言的时候&#xff0c;老师给大家画过这样的空间布局图&#xff0c;但是我们对它不了解 我们写一个代码来验证Linux进程地址空间 #include<stdio.h> #include<assert.h> #include<unistd.h> int g_value100; …

Chrome之解决DevTools: Failed to load data:No resource with given identifier found

问题 使用DevTools抓包时候, 有些跨域请求无法在加载出来, 提示 Failed to load data:No resource with given identifier found 解决办法 换其他浏览器 下断点 打开DevTools, 选择源代码/来源/Sources,找到事件监听器断点/Event Listener Breakpoints, 找到加载/Load下面…

<学习笔记>从零开始自学Python-之-常用库篇(十二)Matplotlib

Matplotlib 是Python中类似 MATLAB的绘图工具&#xff0c;Matplotlib是Python中最常用的可视化工具之一&#xff0c;可以非常方便地创建2D图表和一些基本的3D图表&#xff0c;可根据数据集&#xff08;DataFrame&#xff0c;Series&#xff09;自行定义x,y轴&#xff0c;绘制图…

云可观测性安全平台——掌动智能

云可观测性安全平台是一个跨架构、跨平台的可观测性方案&#xff0c;实现对云环境下的细粒度数据可视化&#xff0c;满足安全部门对云内部安全领域的多场景诉求&#xff0c;包括敏感数据动态监管、云网攻击回溯分析、攻击横移风险监控、云异常流量分析。本文将介绍掌动智能云可…

【ldt_struct】0ctf2021-kernote

前言 题目给的文件系统是 ext4&#xff0c;所以我们只需要将其挂载即可使用&#xff1a; 1、创建一个空目录 2、使用 mount 将其挂载即可 3、使用 umount 卸载即可完成打包 开启了 smap、smep、kaslr 和 kpti 保护&#xff0c;并且给了如下内核编译选项&#xff1a; Her…

java web+Mysql e-life智能生活小区物业管理系统

本项目为本人自己书写&#xff0c;主要服务小区业主和管理人员。 e-life智能生活小区涉及多个方面的智能化和便利化服务&#xff1a; 1. 用户模块&#xff1a;包含基本的登入登出操作&#xff0c;查看个人信息中用户可以查看 自己的个人资料但不可以修改个人信息。 a) 用户…

聊聊分布式架构——序列化和反序列化

目录 序列化与反序列化 为什么需要序列化 常见的序列化方式 java的序列化示例 transient排除序列化 Java序列化的简单总结 序列化与反序列化 序列化就是把对象的状态信息转化为可存储或传输的形式过程&#xff0c;也就是把对象转化为字节序列的过程称为对象的序列化。 反…