gitlab-ce 12.X:如何在服务器上找到存储库的散列存储路径?

icl*_*man 4 git gitlab gitlab-ce

使用 gitlab-ce-12.x,Geo 需要散列存储路径(https://docs.gitlab.com/ee/administration/repository_storage_types.html

对于给定的存储库,数据因此将存储在:“@hashed/#{hash[0..1]}/#{hash[2..3]}/#{hash}.git”

从实际的角度来看,假设我有一个存储库,其 URL 是

https://my-gitlab-server/Group1/project1.git

如何找出服务器上存储的路径?即我如何找到的价值

#{hash[0..1]}/#{hash[2..3]}/#{hash}

谢谢

icl*_*man 6

我找到了我的问题的答案。

为了获取项目的哈希存储位置,您首先需要获取项目存储库的项目 id。

获得该项目 id 后,假设您的项目 id 为 1,您可以通过以下方式获得哈希值:

说 project.id 是 1

回声 -n 1 | sha256sum

=> 你得到 HASH 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b

因此,服务器上存储库的散列存储位置将是:

服务器/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git

这已被 gitlab 开发人员在https://gitlab.com/gitlab-org/gitlab-ce/issues/63250 中讨论过