我已经创建了一个本地 GitLab 实例(Ubuntu 20 中的 GitLab 13.10)并且想要从 GitHub 导入但不镜像项目。在这种情况下,openwrt。我在 GitLab 实例中创建了项目,然后尝试推送到它。
我跑了:
git clone https://git.openwrt.org/openwrt/openwrt.git
git remote rename origin old-origin
git remote add origin http://gitlab.local/group/project.git
git push -u origin --all
我得到了:
Counting objects: 533132, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (142241/142241), done.
Writing objects: 100% (533132/533132), 162.16 MiB | 6.35 MiB/s, done.
Total 533132 (delta 369475), reused 530420 (delta 368128)
remote: Resolving deltas: 100% (369475/369475), done.
remote: Checking connectivity: 533132, done.
remote: GitLab: Push operation timed out
remote:
remote: Timing information for debugging purposes:
remote: Running checks for ref: master
remote: Checking if you are allowed to push... (22.92ms)
remote: Checking if default branch is being deleted... (0.77ms)
remote: Checking if you are force pushing to a protected branch... (579.48ms)
remote: Checking if you are allowed to push to the protected branch... (21.38ms)
remote: Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab... (cancelled after 29409.76ms)
To http://gitlab.local/group/project.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://gitlab.local/group/project.git'
我对另一个项目做了同样的事情并且推送效果很好,所以我认为这个项目不喜欢它。项目中有 9210 个文件,所以我假设这与大量文件有关。
我尝试过的事情:
git config --add lfs.url "http://gitlab.local/group/project.git/info/lfs"
虽然我不确定这有什么作用,但将其设置为“wibble:wobble”并没有让它以任何壮观的方式失败)立>
我认为 LFS 上不应该有任何文件,最大的文件是 4KB。但由于错误提到了 LFS,我想我会使用这些设置。
感谢任何帮助;我在扯头发。
答案 0 :(得分:0)
经过多次尝试并在 GitLab 论坛上提问后,似乎解决方案是使用 rails 控制台禁用 lfs_check
。
在 gitlab 服务器上以 root 身份运行:
gitlab-rails console
等待初始化完成:
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 13.10.0 (5eafdaf7b07) FOSS
GitLab Shell: 13.17.0
PostgreSQL: 12.5
--------------------------------------------------------------------------------
Feature.enable(:lfs_check)
Loading production environment (Rails 6.0.3.4)
irb(main):001:0>
然后发出命令:
irb(main):001:0> Feature.disable(:lfs_check)
它应该返回:
=> true
之后推送成功。
这是使用“临时修复”的“功能标志”修复的,因此在某些时候应该有比这更好的解决方案。