git - 更改数据目录 gitlab 以将 repos 存储在其他地方

标签 git gitlab

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

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

最佳答案

只是更新以防人们仍然提到这个。来自 GitLab documentation :

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"})

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.

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

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

关于git - 更改数据目录 gitlab 以将 repos 存储在其他地方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19902417/

相关文章:

git - 如何配置 Visual Studio 以使用 Beyond compare for TFS GIT?

Git:我可以在不分离 HEAD 的情况下检查提交吗?

windows - Gitlab 工件上传好慢

git - 从 gitlab 克隆 repo 的问题(致命的 : The remote end hung up unexpectedly)

linux - GIT 从远程源 pull 忽略 SSH key - 要求密码

git - 以无密码用户身份执行命令

git - 如何检查git远程仓库

git - 如何更改 Gitlab 中 merge 的默认目标分支

angular - Gitlab CI 构建不工作

gitlab - 如何更改我的 gitlab 安装的默认主页