GitLab 11.1.4 修改默认仓库目录 | IT运维网
  • 欢迎访问本网站;本站QQ交流群:654792529;如果您觉得本站非常有看点,那么赶紧使用Ctrl+D收藏吧!
  • 本站为个人技术性博客网站,上面会更新一些系统、网络、云计算和监控等相关运维的技术性文章,供大家参考、学习和一起交流。

GitLab 11.1.4 修改默认仓库目录

Gitlab yvan 1年前 (2018-08-06) 3520次浏览 已收录 2个评论 扫描二维码
[root@izuf6fy69k7l7e20jogcj7z ~]# ll /var/opt/gitlab/git-data/
total 4
drwxrws--- 2 git root 4096 Aug 20 09:28 repositories

1、首先创建自定义存放目录git-data:mkdir /git-data

[root@izuf6fy69k7l7e20jogcj7z ~]# mkdir /git-data
[root@izuf6fy69k7l7e20jogcj7z ~]# ll /
total 68
lrwxrwxrwx    1 root root     7 Aug 17 14:17 bin -> usr/bin
dr-xr-xr-x.   5 root root  4096 Aug 20 00:48 boot
drwxr-xr-x    2 root root  4096 Aug 20 00:38 data
drwxr-xr-x   19 root root  2980 Aug 20 01:03 dev
drwxr-xr-x.  82 root root  4096 Aug 20 01:02 etc
drwxr-xr-x    2 root root  4096 Aug 20 21:59 git-data
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 home
lrwxrwxrwx    1 root root     7 Aug 17 14:17 lib -> usr/lib
lrwxrwxrwx    1 root root     9 Aug 17 14:17 lib64 -> usr/lib64
drwx------.   2 root root 16384 Oct 15  2017 lost+found
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 media
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 mnt
drwxr-xr-x.   3 root root  4096 Aug 19 22:32 opt
dr-xr-xr-x  153 root root     0 Aug 20 01:03 proc
dr-xr-x---.   6 root root  4096 Aug 20 17:45 root
drwxr-xr-x   24 root root   640 Aug 20 13:32 run
lrwxrwxrwx    1 root root     8 Aug 17 14:17 sbin -> usr/sbin
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 srv
dr-xr-xr-x   13 root root     0 Aug 20 09:03 sys
drwxrwxrwt.  10 root root  4096 Aug 20 17:46 tmp
drwxr-xr-x.  13 root root  4096 Aug 17 14:17 usr
drwxr-xr-x.  19 root root  4096 Aug 17 14:17 var

2、配置git-data目录属主和属组为git:chown git.git /git-data/

[root@izuf6fy69k7l7e20jogcj7z ~]# chown git.git /git-data/
[root@izuf6fy69k7l7e20jogcj7z ~]# ll /
total 68
lrwxrwxrwx    1 root root     7 Aug 17 14:17 bin -> usr/bin
dr-xr-xr-x.   5 root root  4096 Aug 20 00:48 boot
drwxr-xr-x    2 root root  4096 Aug 20 00:38 data
drwxr-xr-x   19 root root  2980 Aug 20 01:03 dev
drwxr-xr-x.  82 root root  4096 Aug 20 01:02 etc
drwxr-xr-x    2 git  git   4096 Aug 20 21:59 git-data
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 home
lrwxrwxrwx    1 root root     7 Aug 17 14:17 lib -> usr/lib
lrwxrwxrwx    1 root root     9 Aug 17 14:17 lib64 -> usr/lib64
drwx------.   2 root root 16384 Oct 15  2017 lost+found
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 media
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 mnt
drwxr-xr-x.   3 root root  4096 Aug 19 22:32 opt
dr-xr-xr-x  153 root root     0 Aug 20 01:03 proc
dr-xr-x---.   6 root root  4096 Aug 20 17:45 root
drwxr-xr-x   24 root root   640 Aug 20 13:32 run
lrwxrwxrwx    1 root root     8 Aug 17 14:17 sbin -> usr/sbin
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 srv
dr-xr-xr-x   13 root root     0 Aug 20 09:03 sys
drwxrwxrwt.  10 root root  4096 Aug 20 17:46 tmp
drwxr-xr-x.  13 root root  4096 Aug 17 14:17 usr
drwxr-xr-x.  19 root root  4096 Aug 17 14:17 var

3、编辑修改配置文件/etc/gitlab/gitlab.rb中的git_data_dirs参数来自定义仓库路径

###!   path that doesn't contain symlinks.**
git_data_dirs({
  "default" => { "path" => "/git-data" }
})

配置后需执行命令gitlab-ctl reconfigure重载配置文件

4、重新配置后GitLab会在自定义仓库目录中自动创建一个repositories目录,表示配置成功。

[root@izuf6fy69k7l7e20jogcj7z ~]# ll /git-data/
total 4
drwxrws--- 2 git root 4096 Aug 20 22:26 repositories

IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明GitLab 11.1.4 修改默认仓库目录
喜欢 (4)
[yvan.lu@ityww.cn]
分享 (0)
yvan
关于作者:
聪明来自勤奋、知识在于积累、好记性不如烂键盘!

您必须 登录 才能发表评论!

(2)个小伙伴在吐槽
  1. 请问是否有修改gitlab 11.1.4 的默认安装目录方法?默认是在根目录,我想修改安装到/data 下面,请各位大神给与帮助
    Andy_wang2018-09-10 14:10 Windows 10 | Chrome 68.0.3440.75
    • yvan
      从官方资料上显示官方是推荐YUM自动安装和基于软件包手动安装这两种方式的,这两种方式都没法自定义安装目录的。你的需求只能用源码安装方式来实现,官方参考地址:https://docs.gitlab.com/ce/install/installation.html
      yvan2018-09-10 19:14 Windows 10 | Chrome 63.0.3239.132