【问题标题】:cannot put to gitlab server restored from backup无法放入从备份恢复的 gitlab 服务器
【发布时间】:2016-08-27 05:51:37
【问题描述】:

我目前在 CentOS 6.5 上运行 GitLab Omnibus v7.1.0(称为 gitlab-a)。我使用 CentOS 6.8 (gitlab-b,这最终将升级到最新的 GitLab 8 版本) 构建了一个新的 GitLab 服务器,通过 RPM 包安装了 GitLab Omnibus v7.1.0 (gitlab-7.1.0_omnibus-1.el6.x86_64.rpm ),使用以下命令在原始服务器 (gitlab-a) 上运行备份:

sudo gitlab-rake gitlab:backup:create

我将生成的备份 tar 文件安全地复制到“新”服务器(在本例中为 gitlab-b)并恢复它:

bundle exec rake gitlab:backup:restore RAILS_ENV=production

我跑了:

sudo gitlab-rake gitlab:check SANITIZE=true

它抱怨权限和缺少卫星。我按照给定的方向:

chmod -R ug+rwX,o-rwx /var/opt/gitlab/git-data/repositories
chmod -R ug-s /var/opt/gitlab/git-data/repositories
find /var/opt/gitlab/git-data/repositories -type d -print0 | sudo xargs -0 chmod g+s
sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production

我测试了这个新安装(gitlab-b)并且能够git clonegit pull 没有任何问题。但是,当我创建一个分支(称为 test-123),在 test-123 分支中进行更改,然后尝试 git push test-123 分支(git push origin test-123)时,我收到以下错误:

Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 331 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: GitLab: You are not allowed to access test-123!
remote: error: hook declined to update refs/heads/test-123
To git@gitlab.gitlab-b.com:project/repo.git
 ! [remote rejected] test-123 -> test-123 (hook declined)
error: failed to push some refs to 'git@gitlab.gitlab-b.com:project/repo.git'

我还注意到在新的 gitlab-b 服务器上,/var/opt/gitlab/git-data/repositories/project/repo.git/refs/heads 目录是空的。我认为这是问题的部分原因。我不确定如何解决。

这两天我搜索了大部分时间,发现了许多相关的问题和解决方案;不幸的是,我无法找到解决此问题的解决方案。任何让我朝着正确方向前进的想法或任何事情都将不胜感激!提前感谢您的宝贵时间。如果需要任何其他信息,请告诉我。

【问题讨论】:

  • 您是否检查了 repo 的安全设置?是否配置了受保护的分支?并且:您可以尝试在服务器上的 repo.git 中手动创建您的分支(通过git branch)吗?
  • 你好安德烈亚斯!对不起,我的回复延迟了。我们确实使用安全和受保护的分支。这些设置与 gitlab-a 存储库相匹配。我将此项目设置为内部和公共,但仍然无法推动。返回相同的错误。我是项目的所有者。我还在服务器上手动创建了 repo.git 并尝试推送 - 同样的错误。感谢您的时间和帮助。我真诚地感谢它。

标签: gitlab


【解决方案1】:

如果有人遇到这个并且似乎已经用尽了所有其他好的建议,请检查 /opt/gitlab 下是否有符号链接链接到另一个目录。就我而言,我将默认的 git_data_dir /opt/gitlab/git-data 符号链接到 /home/gitlab/opt/gitlab/git-data 因为 /home 分区的磁盘空间最多。

处理此问题的正确方法不是使用符号链接,而是通过编辑 /etc/gitlab/gitlab.rb,添加以下行:

git_data_dir "/home/gitlab/opt/gitlab/git-data"

并运行 gitlab 重新配置:

sudo gitlab-ctl reconfigure

参考资料: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md#storing-git-data-in-an-alternative-directory

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template#L215-219

非常感谢那些花时间提供帮助、评论和/或阅读的人。非常感谢您的宝贵时间!

最好的问候!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 2012-05-11
    • 2022-01-11
    相关资源
    最近更新 更多