(一)gitblit安装教程-程序员宅基地

技术标签: git  scm  

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

前言

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
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/fedorayang/article/details/133435220

智能推荐

vue3使用的移动端UI框架,vue3.0 ui组件库_vue3 移动端框架下载-程序员宅基地

文章浏览阅读1k次。Laydate控件如何只显示年份如下所示在下面加入css样式 便只显示年份了.laydate_m,.laydate_table{ display:none;} Laydate控件如何只显示时分秒#laydate_box.laydate_top,#laydate_box.laydate_table,#laydate_today{display:none;}当然都还需要对应修改下面的format$(document).ready(function(){laydate({elem:'#haha',//目标元素。_vue3 移动端框架下载

ubuntu桌面卡死_ubuntu 设置桌面 卡死-程序员宅基地

文章浏览阅读402次。ubuntu桌面卡死问题如何解决之前的操作就是关机、重启现在找到一种新的解决办法:切换到tty模式,执行pkill X;start X;即可补充一点:Ctrl+Atl+F3/F4/F5/F6 进入ttyCtrl+Atl+F2退出tty不过有一点:所有的进程都会被杀死,重新进来之后,啥都没有了,不过好像重启也会这样的。..._ubuntu 设置桌面 卡死

Java面向对象——多态 详解_son son=(parent) parent-程序员宅基地

文章浏览阅读279次。java基础**面向对象——多态** 来,此篇博客来看看Java面向对象最后一篇——多态,也是Java最简单的最后部分了。 这个多态呀。就是事物的多种形态,主要分为静多态和动多态多态 前提:不知道还记得继承和方法重写重载么。 体现:父类引用或者接口引用执行子类的对象。(就是基类的引用引用派生类的对象)我记..._son son=(parent) parent

python字符串类型_Python-数据类型-字符串-程序员宅基地

文章浏览阅读278次。数据类型-字符串字符串是 python最常见的基本数据类型之一,常见的定义方式是一对单引号( '……')或者一对双引号 ("……")创建,多行字符串也可使用三单引号或者三双引号定义。1. 特点不可变类型: 在元素定义之后不能对其进行修改,否则会报错可以进行切片和索引操作: 索引下标从零开始示例a = "hello world"b = 'hello python'print(type(a), typ..._name[:-4:-1]

【渝偲】DSPE-PEG-Galactose;DSPE-PEG-半乳糖;磷脂聚乙二醇半乳糖 长循环脂质体-程序员宅基地

文章浏览阅读680次。中文名称:磷脂-聚乙二醇-半乳糖 半乳糖-聚乙二醇-磷脂简称:DSPE-PEG-Galactose Galactose-PEG-DSPE外观: 根据不同的分子量为半固体或固体分子量(PEG ):1000、2000、3400、5000,其他分子量可以定制。溶剂:溶于部分常规有机溶剂存储条件:-20℃以下冰冻、干燥、避光。长期保存惰性(氩气或者氮气)保护。二硬脂酰磷脂酰乙醇胺-聚乙二醇-半乳糖对脂质体表面进行聚乙二醇修饰后,得到长循环脂质体可以延长脂质体的半衰期和提高它在血液循环中的稳定性、改变脂质体的生物_dspe-peg-gal

Spring Security自定义登录验证(不使用userDetailsService)_spring security 不使用userdetailservice-程序员宅基地

文章浏览阅读1.3w次,点赞2次,收藏16次。一:功能说明实现了自定义登录验证(AuthenticationProvider)二:具体代码1.自定义AuthenticationProvider/** * @author LEI * Created by LEI on 2019/5/30. */@Componentpublic class MyAuthenticationProvider implements A..._spring security 不使用userdetailservice

随便推点

[XSCTF]easyxor-程序员宅基地

文章浏览阅读245次。在这个循环里,将异或得到的结果每次减去1,同时在数组里写上1,往后遍历数组。查看,main函数,首先是将输入的数据与key中的字符依次异或。直到异或得到的结果减为0,在数组中写一个0进行标记。最后比较数组是否与r数组相同。_easyxor

NVIDIA DALI从入门到放弃之一:概述_nvidia dail-程序员宅基地

文章浏览阅读2.8k次,点赞3次,收藏19次。NVIDIA DALI从入门到放弃之一:概述NVIDIA DALI从入门到放弃之二:入门示例NVIDIA DALI从入门到放弃之三:Data LoadingNVIDIA DALI从入门到放弃之四:Multiple GPUNVIDIA DALI从入门到放弃之五:Image ProcessingNVIDIA DALI从入门到放弃之六:Geometric TransformsNVIDIA DALI从入门到放弃之七:Sequence ProcessingNVIDIA DALI从入门到放弃之八:PyTo_nvidia dail

csf的安装-程序员宅基地

文章浏览阅读165次。安装CSF 防火墙通常是我们在服务器上所做的第二件事。防火墙的主要目的是为了帮助完成如下任务:1 防止暴力破解密码,自动屏蔽连续登陆失败的IP2 管理网络端口,只开放必要的端口3 免疫小流量的 DDos 和 CC ***。(对于免疫这些的*** 个人感觉也就那么回事)CSF是一个功能完善的防火墙,并且提供 cPanel 插件,便于管理。当然除了 Web GUI..._如何安装csf包

CMake 使用_set( cmake_cxx_flags "${cmake_cxx_flags} -y_gpp")-程序员宅基地

文章浏览阅读1k次,点赞2次,收藏6次。CMake使用_set( cmake_cxx_flags "${cmake_cxx_flags} -y_gpp")

ai换脸可以突破人脸识别吗,有没有技术可以攻破_ai换脸可以人脸识别吗-程序员宅基地

文章浏览阅读177次。在机器学习中,对抗性攻击指的是利用模型的弱点来误导模型做出错误决策的方法。通过对抗性攻击生成的图像或视频可能包含细微的、专门设计的扰动,这些扰动对人眼几乎不可见,但可以使得人脸识别系统无法正确识别。如果AI生成的换脸图像足够逼真,它可能会误导基于图像的人脸识别系统。尽管采取了这些防御措施,没有任何安全系统是绝对安全的,而技术的进步总是在不断地推动攻防之间的较量。通过创建目标人脸的3D模型,并将其用于生成图像或视频,可以生成能够误导2D或3D人脸识别系统的视觉内容。_ai换脸可以人脸识别吗

推荐文章

热门文章

相关标签