redmine整合gitlab版本库

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/danqingc/article/details/88035876

Clone 版本库

如果想在Redmine上看到gitlab上的版本库,需要在redmine用户对gitlab的repository有读写权限这里我的redmine的用户是apache。

1. 创建gitlab repository的目录,并且改成跟redmine同一个用户

mkdir /opt/gitlab-repo

chown -R apache:apache /opt/gitlab-repo

chmod -R a+rwx gitlab-repo/

chown -R apache:apache /var/www/.ssh

2.创建public key:

sudo -u apache -H ssh-keygen -t rsa

3. 把id_rsa.pub拷贝到gitlab的SSH key中

4. 使用 MIRROR 模式来 Clone 版本库。Mirror 模式的版本库将仅包含提交信息而不包含具体提交的文件。这样 Clone 的内容比较小,速度足够快。

cd /opt/gitlab-repo

sudo -u apache -H git clone --mirror git@192.168.100.7:kernel/hgdb-core.git purog

5. 设置默认显示的版本分支

sudo -u apache -H git symbolic-ref HEAD refs/heads/Purog_3.0

配置 Redmine

1.在redmine中指定git项目的仓库位置

在项目中新建一个对应的项目,点击配置,新建版本库

 

scm选择git

指定库路径,这个路径不是http的路径,而是这个仓库在redmine服务器上的文件路径

 

需要注意,这些文件的路径需要有读取权限,不然会显示404

配置完成之后,在redmine的版本库选卡项就可以看到git的提交历史记录了。

 

定时刷新版本库

有多种方法,我使用crond job

[root@highgo gitlab-repo]# cat cron_job

*/5 * * * * cd /opt/gitlab-repo/purog && sudo -u apache -H git fetch

*/5 * * * * cd /opt/gitlab-repo/migration && sudo -u apache -H git fetch

[root@highgo gitlab-repo]# crontab -u root /opt/gitlab-repo/cron_job


[root@highgo gitlab-repo]# crontab -l

*/5 * * * * cd /opt/gitlab-repo/purog && sudo -u apache -H git fetch

*/5 * * * * cd /opt/gitlab-repo/migration && sudo -u apache -H git fetch


[root@highgo gitlab-repo]# tail -f /var/log/cron

Feb 28 17:15:01 highgo crond[2406]: (root) RELOAD (/var/spool/cron/root)

Feb 28 17:15:01 highgo CROND[1443]: (root) CMD (cd /opt/gitlab-repo/purog && sudo -u apache -H git fetch)

Feb 28 17:15:01 highgo CROND[1444]: (root) CMD (cd /opt/gitlab-repo/migration && sudo -u apache -H git fetch)

Feb 28 17:16:27 highgo crontab[1535]: (root) LIST (root)

Feb 28 17:20:01 highgo CROND[1697]: (root) CMD (cd /opt/gitlab-repo/purog && sudo -u apache -H git fetch)

Feb 28 17:20:01 highgo CROND[1698]: (root) CMD (/usr/lib64/sa/sa1 1 1)

Feb 28 17:20:01 highgo CROND[1699]: (root) CMD (cd /opt/gitlab-repo/migration && sudo -u apache -H git fetch)

Feb 28 17:25:01 highgo CROND[1977]: (root) CMD (cd /opt/gitlab-repo/purog && sudo -u apache -H git fetch)

Feb 28 17:25:01 highgo CROND[1979]: (root) CMD (cd /opt/gitlab-repo/migration && sudo -u apache -H git fetch)

Feb 28 17:26:50 highgo crontab[2058]: (root) LIST (root)

 

展开阅读全文

redmine连接subversion版本库问题,出现500错误

10-08

ruby 1.9.3p448rnRails 3.2.13rnredmine-2.3.3rn别的功能都可以正常使用,但使用redmine连接subversion版本库时rn[img=https://img-bbs.csdn.net/upload/201310/08/1381220447_186399.jpg][/img]rn点击版本库选项后出现500错误,[u]不知道是什么问题?求帮助![/u]rn[img=https://img-bbs.csdn.net/upload/201310/08/1381220298_479054.jpg][/img]rn[b]redmine log信息如下[/b]rnActionView::Template::Error (undefined method `-' for :length=>50:Hash):rn 25: <%= link_to_revision(entry.changeset, @repository) if entry.changeset %>rn 26: <%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %>rn 27: <%= entry.author %>rn 28: <%=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %>rn 29: <% end %>rn 30: rn 31: <% end %>rn config/environment.rb:22:in `truncate'rn app/views/repositories/_dir_list_content.html.erb:28:in `block in _app_views_repositories__dir_list_content_html_erb__4244999199527241588_58948520'rn app/views/repositories/_dir_list_content.html.erb:1:in `each'rn app/views/repositories/_dir_list_content.html.erb:1:in `_app_views_repositories__dir_list_content_html_erb__4244999199527241588_58948520'rn app/views/repositories/_dir_list.html.erb:16:in `_app_views_repositories__dir_list_html_erb__780208683014920164_58915120'rn app/views/repositories/show.html.erb:11:in `_app_views_repositories_show_html_erb__3973464992110231650_58544200'rn app/controllers/repositories_controller.rb:125:in `show'rnrn 论坛

没有更多推荐了,返回首页