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

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

问题描述

我将我的裸Git存储库导入到Gitlab中,如此处所述,因为它没有被认为是一个Git仓库,但创建了一个94K大的'空'回购(原始大小为2,8GB):

  $ bundle exec rake gitlab:import:repos RAILS_ENV = production 
fatal:不是git仓库(或任何父目录):.git
处理test.git
INFO:Sidekiq客户端使用redis:// localhost:6379 with options:namespace =>resque:gitlab}
*创建测试(test.git)
完成!

作为解决方法,我用裸回购库替换空的项目文件夹(通过导入试用版创建) 。后来我树从远程复制回购,并得到以下错误:

  $ git clone git@mydomain.com:.. .test.git 
克隆到'test'
fatal:'... test.git'似乎不是git存储库
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限
并存在存储库。

但是git用户应该拥有所有需要的权利。 - 可能我忽略了一些东西?



我的系统:RHEL6.3,Git 1.8.3.4,Gitlab5.3。



Gitlab需要一个正常的存储库(非裸露的)吗?或者可能是我的问题?

解决方案


Gitlab需要一个正常的存储库(非裸) ?

不,所有由gitlab管理的回购券都是裸回购。

您应该看到:

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

请确保 test.git 文件夹(及其中的裸回购文件)的权限与<$下的现有裸回购c $ c> / home / git / repositories / 。



如果导入不起作用,那么替换空的项目文件夹这是由进口试验创建的)与我裸露的回购应该。/ b>

但是:您需要确保任何挂钩在GitLab创建的空裸回购〜git / repositories / arepo.git / hooks )复制到您的完整裸回购库中,替换清空一个(相同的路径)。

检查〜git / repositories / arepo.git / info 〜〜 git / repositories / arepo.git / config



要进行调试,请先尝试克隆GitLab在导入失败期间创建的空裸回购。

然后将它替换为您自己的,仔细检查钩子并重试。






OP 提及 a>并记录在GitLab中 Trouble Shooting Guide ,正确的ssh url是:

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

with :存储库 $ b

要导入裸回购(如 Sytse Sijbrandij 并在 raketasks
$ b


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!

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.

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

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

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

解决方案

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

No, all repos managed by gitlab are bare repos.

You should see:

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

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.

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

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.


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

with :repositories mentioned.


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

  • 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天全站免登陆