更改数据目录 gitlab 以将 repos 存储在其他地方 [英] change the data directory gitlab to store repos elsewhere

查看:14
本文介绍了更改数据目录 gitlab 以将 repos 存储在其他地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 gitlab 安装的基本磁盘已满,是否可以将存储库及其数据移动到其他文件夹并确保即将推送的数据发送到这些目录?

my basic disk is full for my gitlab installation, is it possible to move the repositories and their data to some other folder and make sure that the upcoming push's data is sent to those directories?

我尝试停止 gitlab 并复制整个文件夹,但无济于事.PS - 我不是 IT 人,我只是想看看我们如何才能摆脱这个问题;所以请在回答时详细说明.

I tried stopping the gitlab and copying over the entire folder, but to no avail. PS - I am not an IT guy, I am just pitching in to see how could we get out of this issue; so please be verbose when answering.

推荐答案

只是更新以防人们仍然参考这个.来自 GitLab 文档:

Just updating in case people still refer to this. From the GitLab documentation:

omnibus-gitlab 默认将 Git 仓库数据存储在/var/opt/gitlab/git-data.存储库存储在子文件夹中存储库.您可以更改 git-data 父级的位置通过将以下行添加到 /etc/gitlab/gitlab.rb.

By default, omnibus-gitlab stores the Git repository data under /var/opt/gitlab/git-data. The repositories are stored in a subfolder repositories. You can change the location of the git-data parent directory by adding the following line to /etc/gitlab/gitlab.rb.

git_data_dirs({"default" => "/mnt/nas/git-data"})

从 GitLab 8.10 开始,您还可以添加多个 git 数据通过将以下行添加到 /etc/gitlab/gitlab.rb 目录而是.

Starting from GitLab 8.10 you can also add more than one git data directory by adding the following lines to /etc/gitlab/gitlab.rb instead.

git_data_dirs({
  "default" => "/var/opt/gitlab/git-data",
  "alternative" => "/mnt/nas/git-data"
})

请注意,目标目录及其任何子路径都不能是符号链接.

Note that the target directories and any of its subpaths must not be a symlink.

运行 sudo gitlab-ctl reconfigure 以使更改生效.

Run sudo gitlab-ctl reconfigure for the changes to take effect.

如果您已经拥有现有的 Git 存储库/var/opt/gitlab/git-data 您可以将它们移动到新位置如下:

If you already have existing Git repositories in /var/opt/gitlab/git-data you can move them to the new location as follows:

# Prevent users from writing to the repositories while you move them.
sudo gitlab-ctl stop

# Note there is _no_ slash behind 'repositories', but there _is_ a
# slash behind 'git-data'.
sudo rsync -av /var/opt/gitlab/git-data/repositories /mnt/nas/git-data/

# Fix permissions if necessary
sudo gitlab-ctl reconfigure

# Double-check directory layout in /mnt/nas/git-data. Expected output:
# gitlab-satellites  repositories
sudo ls /mnt/nas/git-data/

# Done! Start GitLab and verify that you can browse through the repositories in
# the web interface.
sudo gitlab-ctl start

这篇关于更改数据目录 gitlab 以将 repos 存储在其他地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆