如何将现有的裸 git 存储库导入 Gitlab? [英] How to import an existing bare git repository into Gitlab?

查看:55
本文介绍了如何将现有的裸 git 存储库导入 Gitlab?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 here 中的描述将我的裸 git 存储库导入 Gitlab ,因为它未被识别为 git 存储库,而是创建了一个 94K 的大空"存储库(原始为 2,8GB 大):

I import my bare git repository into Gitlab as described as here , because it was not recognized as an git repository, but creates a 94K big 'empty' repo (the original is 2,8GB big):

$ bundle exec rake gitlab:import:repos RAILS_ENV=production
fatal: Not a git repository (or any of the parent directories): .git
Processing test.git
INFO: Sidekiq client using redis://localhost:6379 with options:namespace=>"resque:gitlab"}
 * Created test (test.git)
Done!

作为一种解决方法,我将空项目文件夹(由导入试验创建)替换为我的裸仓库.之后我从远程克隆 repo 并得到以下错误:

As a workaround I replace the empty project folder (which was created by import trial) with my bare repo. Afterwards I tree to clone the repo from remote and get the following error:

$ git clone git@mydomain.com:...test.git
Cloning into 'test'
fatal: '...test.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

但是 git 用户应该拥有所需的所有权限.-也许我忽略了什么?

But the git user should have all rights which are needed. -Maybe I have something overlooked?

我的系统:RHEL6.3、Git 1.8.3.4、Gitlab5.3.

My System: RHEL6.3, Git 1.8.3.4, Gitlab5.3.

Gitlab 是否需要一个普通的仓库(非裸)?或者我的问题是什么?

Does Gitlab need a normal repository (non-bare)? Or what could be my problem?

推荐答案

Gitlab 是否需要一个普通的仓库(非裸)?

Does Gitlab need a normal repository (non-bare)?

不,gitlab 管理的所有存储库都是裸存储库.

No, all repos managed by gitlab are bare repos.

你应该看到:

/home/git/repositories/user1/repo1.git
/home/git/repositories/user1/repo2.git
/home/git/repositories/greoup1/repo3.git
...

确保您的 test.git 文件夹(以及其中的裸仓库文件)的权限与 /home/git/repositories/.

Make sure the rights of your test.git folder (and bare repo files within it) are the same than the existing bare repos under /home/git/repositories/.

如果导入不起作用,那么用我的裸仓库替换空项目文件夹(由导入试验创建)"应该.

If the import doesn't work, then "replace the empty project folder (which was created by import trial) with my bare repo" should.

但是:您需要确保由 GitLab 创建的空裸仓库中的任何钩子(在 ~git/repositories/arepo.git/hooks 中)被复制到您的完整裸仓库替换空的(相同的路径).
还要检查 ~git/repositories/arepo.git/info~git/repositories/arepo.git/config

But: you need to make sure any hook which was in the empty bare repo created by GitLab (in ~git/repositories/arepo.git/hooks) is copied over your full bare repo replacing the empty one (same path).
Check also what was in ~git/repositories/arepo.git/info and ~git/repositories/arepo.git/config

要调试,首先尝试克隆在导入失败期间由 GitLab 创建的空裸仓库.
然后用你自己的替换它,仔细检查挂钩并重试.

To debug, try first to clone the empty bare repo created by GitLab during the failed import.
Then replace it with your own, double-check the hooks and try again.

提及>OP 并记录在 GitLab "Trouble Shooting Guide",正确的 ssh url 为:

As mentioned by the OP and documented in GitLab "Trouble Shooting Guide", the correct ssh url is:

git@git.myserver.com:repositories/mygroup/proj1.git

提到了:repositories.

with :repositories mentioned.

导入裸存储库(如 Sytse Sijbrandij 下面raketasks/import.md)

To import bare repos (as mentioned by Sytse Sijbrandij below and in raketasks/import.md)

  • 在 git repos_path 下复制你的裸仓库(见 config/gitlab.yml gitlab_shell -> repos_path)
  • 运行下面的命令

  • copy your bare repos under git repos_path (see config/gitlab.yml gitlab_shell -> repos_path)
  • run the command below

bundle exec rake gitlab:import:repos RAILS_ENV=production

这篇关于如何将现有的裸 git 存储库导入 Gitlab?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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