运行环境:

RedMine: 4.0.4

Git 仓库: Gitbilt V1.8.0

必须:

  1. Redmine 安装并可运行
  2. Redmine运行的主机里面已经安装了 Git,因需要在命令行中运行 git 命令

我运行的是bitnami的Redmine的Virtualbox 版本。地址是: Bitnami Redmine

启动虚拟机之后,开机完成之后,会出现

  1. 访问地址
  2. redmine 默认的登录的用户名和密码,redmine默认的登录密码也是 mysql root 用户的密码 Obtain MySQL Credentials
  3. 访问控制台(ssh)的默认用户名和密码

: 如果 运行ifconfig 命令,提示ifconfig命令找不到,可以尝试运行sudo ifconfig

开始以为是没有安装 net-tools,尝试命令sudo apt install net-tools去安装,提示已经安装了。

虚拟机默认是禁用ssh登录的,通过官方的教程Enable Or Disable The SSH Server

debian

sudo rm -f /etc/ssh/sshd_not_to_be_run
sudo systemctl enable ssh
sudo systemctl start ssh

将仓库拷贝到本地

bitnami@debian:~$ cd ~
bitnami@debian:~$ mkdir gitrepos
bitnami@debian:~$ sudo chown -R www-data:www-data gitrepos
bitnami@debian:~$ sudo chmod -R a+rwx gitrepos
bitnami@debian:~$ cd gitrepos
bitnami@debian:~/gitrepos$ sudo -u www-data -H git clone --mirror git://192.168.1.142/test.git test

是将对应项目的git镜像到本地(不是源码下载到本地哦)

Readmine 配置

  1. 查看 Git 是否可用

  1. 给项目新建版本库

修正: 库路径结尾没有.git ,因为上面已经取了别名是test

查看是否能正常显示源码

从上图可以看到,成功显示源码和提交历史。如果开始是一个空仓库,可能会提示类似"该目录下没有条目或者文件"

  1. 使用 Linux的定时任务定时拉取仓库

创建一个 shell 文件,如: git_repo_test.sh,内容

#!/bin/bash

cd /home/bitnami/gitrepos/test && sudo -u www-data -H git fetch

保存之后,尝试运行脚本,运行成功,

下一步将定时每5分钟运行这个脚本

crontab -e

在打开的crontab 编辑文件中添加

*/5 * * * * cd /home/bitnami/gitrepos/test && sudo -u www-data -H git fetch

编辑完之后,重启 cron 服务

sudo service cron restart

最后在 Redmine中,看到 仓库的更新记录,如果有新提到远程仓库,5分钟之后,会通过定时任务自动拉取提交的记录


其它 Redmine和GitBilt 集成

  1. 在管理,版本库,开启 Web Service,并生成key 和 对Readmine的通知

跟踪标签 用于解决问题的关键字 应用后的状态 % 完成
全部 fixes,fixed Resolved 80%
全部 closes,closed Closed 100%
全部 developing,doing In Progress 20%
  1. 开启 Readmine的API



    API选项卡 里面的两个都勾选

  2. 修改Gitbilt 配置文件

修改 Gitbilt 文件夹下datagitblit.properties 文件

在文件夹中,添加

groovy.customFields = "redmineProject=Redmine Project Identifier"

最后我的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
groovy.customFields = "redmineProject=Redmine Project Identifier"
#
# Define your overrides or custom settings below
#
#git.repositoriesFolder=E:\devops\gitblit\repos
server.httpPort=10101
server.httpBindInterface=0.0.0.0 #tickets.service = com.gitblit.tickets.FileTicketService
#tickets.acceptNewTickets = true
  1. 修改 GitBilt 的redmine-fetch.groovy 文件

修改 GitBilt 安装文件夹下,修改data/groovy 文件夹下的 redmine-fetch.groovy 文件,修改 redmineURLapiKey 2个变量的值,修改的值如下:

/*
* This script triggers automatic repo fetches in Redmine upon pushes.
* It won't work out-of-box, you need to configure a few things.
*
* Redmine
* - Go to Administration / Settings / Repositories, and make sure that the
* "Enable WS for repository management" option is checked. Also generate an
* API key and take note of it.
* - Open a project page, go to Settings / Repositories and add a repo. Take
* note of the Identifier.
*
* Gitblit
* - Set the redmineProject custom field in gitblit.properties, e.g.
* groovy.customFields = "redmineProject=Redmine Project Identifier"
* - Edit the repo you added to Redmine, go to hook scripts and add this script
* to the post-receive hooks. Also specify the Redmine project's identifier
* under custom fields.
*
* Troubleshooting
* - run Gitblit interactively and check its console output
* - on the Redmine server, tail -f log/access.log
*
* If you want your repos to work with multiple Redmine projects, you don't need
* to add the repos to all of them. Instead, add the repo to a single project,
* then go to Administration / Settings / Repositories and enable the "Allow
* issues of all the other projects to be referenced and fixed" option.
*/ /* specify the URL of your Redmine instance here */
def redmineURL = "http://192.168.1.114/" /* specify the API key you generated in Redmine Administration here */
def apiKey = "R15mHY73KaTzUpCDmOYr" /*
* construct the URL from global and repo properties, for more info refer to
* http://www.redmine.org/projects/redmine/wiki/RedmineSettings#Fetch-commits-automatically
*/
def triggerURL = redmineURL + "sys/fetch_changesets?id=" + repository.customFields.redmineProject + "&key=" + apiKey /* log the action */
logger.info("Redmine Fetch hook triggered by ${user.username} for ${repository.name}: GET ${triggerURL}") /* send the HTTP GET query */
new URL(triggerURL).getContent()

修改完之后,重启启动GitBilt

下一步,在 版本库列表,进入仓库 test详情页,点击右上角的 "编辑"按钮

进入编辑页面之后,选择receive 选项卡,进入Receive 设置页面

最后 给 test仓库推送提交,GitBilt的命令窗口显示,请求Redmine的Api地址成功


bitnami redmine 程序的命令备忘

sh /opt/redmine-3.4.4-1/ctlscript.sh restart

sh /opt/redmine-3.4.4-1/ctlscript.sh restart mysql

/opt/redmine-3.4.4-1/ruby/bin/bundle install --path vendor/bundle

sudo /opt/redmine-3.4.4-1/mysql/bin/mysqld_safe --pid-file=/opt/redmine-3.4.4-1/mysql/data/mysqld.pid --datadir=/opt/redmine-3.4.4-1/mysql/data --init-file=/home/test/mysql-init 2> /dev/null &

/opt/redmine-3.4.4-1/mysql/bin/mysqldump -A -u root -p > backup.sql
References
  1. Debian9 ifconfig命令找不到解决办法 学习到 ifconfig 命令是属于nettools软件的
  2. redmine集成git
  3. redmine整合gitlab版本库 学习到给仓库存放文件夹的拥有者为apache用户和分配权限,最后 定时任务 更新仓库成功啦
  4. Hook redmine git repository via gitblit 我安装使用的Redmine已经有自带redmine-fetch.groovy 文件,所以不需要按文章中介绍的编辑 groovy文件
  5. RedmineとGitLabの連携。PushでチケットのStatusを変更 gitlab 和 redmine 整合
  6. redmine edit issue description
  7. redmine roles wiki
  8. redmine gitlab 整合
  9. Visibility level visibilitylevel|public is not allowed in a visibilitylevel|private group.
  10. GitLabとRedmineを連携してみるの巻
  11. Create And Restore Application Backups redmine创建和还原应用程序备份

Redmine 和GitBlit仓库服务器整合的更多相关文章

  1. Python第十三天 django 1.6 导入模板 定义数据模型 访问数据库 GET和POST方法 SimpleCMDB项目 urllib模块 urllib2模块 httplib模块 django和web服务器整合 wsgi模块 gunicorn模块

    Python第十三天   django 1.6   导入模板   定义数据模型   访问数据库   GET和POST方法    SimpleCMDB项目   urllib模块   urllib2模块 ...

  2. Gitblit版本服务器环境部署记录

    Gitblit介绍Gitblit 是一个纯 Java 库用来管理.查看和处理 Git 资料库.相当于 Git 的 Java 管理工具,支持linux系统.Git是分布式版本控制系统,它强调速度.数据一 ...

  3. Windows下Apache+Tomcat+jsp+php的服务器整合配置经验总结

    对于Apache+Tomcat+jsp+php的整合,针对不同的Tomcat和apache的版本,稍微有些区别. 一.所需软件 (1)JDK: jdk-7u15-windows-x64.exejdk的 ...

  4. mac 布置 git仓库服务器

    创建管理员账户 例如:git 使用git账户登录 开启git账户的远程登陆 创建仓库文件夹 sudo git --bare init 更改配置文件 cd /Users/userName/project ...

  5. 创建Gitblit本地服务器(For windows )01

    1.先下载gitblit  貌似需要FQ,百度云链接https://pan.baidu.com/s/1WUtBswj5TkFFcd_hiFFCcw,提取码: xr9n .因为gitblit是基于jav ...

  6. linux 搭建局域网YUM源仓库服务器

    yum简介 Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器.基于RPM包管理,能够从指定的服 ...

  7. 97、配置yum源仓库服务器

    (服务端(双(外,内)网卡)--客户端(内网)) YUM主要用于自动安装.升级rpm软件包,它能自动查找并解决rpm包之间的依赖关系.要成功的使用YUM工具安装更新软件或系统, 就需要有一个包含各种r ...

  8. docker-registry 搭建私有仓库服务器

    我使用了两个虚拟机: 1)Ubuntu是服务器ip:192.168.84.128 2)centos是客户端ip:192.168.84.129 1.在服务端下载registry镜像  docker pu ...

  9. 关于RabbitMQ服务器整合(二)

    准备工作 15min IDEA maven 3.0 在开始构建项目之前,机器需要安装rabbitmq,你可以去官网下载,http://www.rabbitmq.com/download.html ,如 ...

随机推荐

  1. Linux使用yum install 安装程序时,提示“另外一个程序锁定了 yum;等待它退出……”

    Linux使用yum install 安装程序时,提示“另外一个程序锁定了 yum:等待它退出……” 原因: yum命令一次只能安装一个软件,所以当你下载安装第二个软件包时,系统进程锁会锁定yum,这 ...

  2. sql server 事务隔离性 snapshot 、read committed说明

    一. --该 read committed 默认事务隔离级别 在 systemuser修改事务未完成时 select * from [SystemUser] where id=62; 该语句是不可读取 ...

  3. npm install 时 提示err code EINTEGRITY报错

    1.报错截图如图: 2.报错缘由:因npm 版本问题导致 3.解决方法:升级npm版本(npm i -g npm),再重新npm install即可.

  4. DQN的第一次尝试 -- 软工结对编程第一次作业

    DQN的第一次尝试 在本篇博客中将为大家形象地介绍一下我对DQN的理解,以及我和我的队友如何利用DQN进行黄金点游戏.最后我会总结一下基于我在游戏中看到的结果,得到的dqn使用的注意事项和这次游戏中我 ...

  5. (转)数字证书, 数字签名, SSL(TLS) , SASL

    转:http://blog.csdn.net/xueshanfeihu0/article/details/9154219 因为项目中要用到TLS + SASL 来做安全认证层. 所以看了一些网上的资料 ...

  6. undefined reference to `mysql_init'解决办法

    命令行后面加入 -l mysqlclient 例如: 对mysqlQuery.c编译,使用gcc mysqlQuery.c -o mysqlQuery -l mysqlclient,即可编译成功.

  7. 【SVN】提交报错:×××文件is not under version control

    解决方法:1.删除出错的文件,然后在出错文件所在文件夹执行还原操作 2.VS中可将文件先排除在项目外,再包含在项目内,即可正常提交

  8. JAVA中HashMap相关知识的总结(一)

    Java中HashMap在jdk1.7和jdk1.8中的区别点: 在jdk1.7中是用数组+链表形式存储,1.8采用数组+链表/红黑树形式 Jdk1.8中由链表转为红黑树是长度大于8,由红黑树转为链表 ...

  9. php5模块pdo、pdo_mysql、mysqli的添加

    一.环境LAMP都是源码安装,PHP安装的时候没有配置pdo_mysql和mysqli,pdo是php5默认带的.PHP5的源码都在,只需要把php5的模块功能扩展就可以了. php源码目录:/usr ...

  10. 谈谈-Android Studio 调试功能

    先编译好要调试的程序. 1.设置断点 选定要设置断点的代码行,在行号的区域后面单击鼠标左键即可. 2.开启调试会话 点击红色箭头指向的小虫子,开始进入调试. IDE下方出现Debug视图,红色的箭头指 ...