如何将现有的裸git存储库导入Gitlab?

时间:2013-08-13 16:26:45

标签: git import repository gitlab

我将我的裸git存储库导入到Gitlab中,如here所述,因为它不被识别为git存储库,但创建了一个94K大的“空”存储库(原始版本为2,8GB大):< / p>

$ 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并得到以下错误:

$ 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用户应该拥有所需的所有权限。 - 也许我有一些被忽视的东西?

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

Gitlab需要一个普通的存储库(非裸机)吗?或者可能是我的问题?

4 个答案:

答案 0 :(得分:12)

答案 1 :(得分:9)

  

Gitlab是否需要普通的存储库(非裸)?

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

您应该看到:

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

确保test.git文件夹(及其中的裸仓库文件)的权限与/home/git/repositories/下的现有裸仓库相同。

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

但是:你需要确保GitLab(在~git/repositories/arepo.git/hooks)中创建的空裸仓中的任何钩子都被复制到你的完整裸仓上,替换空仓(同一路径)。
另请查看~git/repositories/arepo.git/info~git/repositories/arepo.git/config

中的内容

要进行调试,首先尝试克隆导入失败时由GitLab创建的空裸存储库 然后用你自己的替换它,仔细检查钩子然后再试一次。


mentioned作为OP并在GitLab“Trouble Shooting Guide”中记录,正确的ssh网址为:

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

提到 :repositories


导入裸存储库(如Sytse Sijbrandij belowraketasks/import.md所述)

  • 在git repos_path下复制您的裸存储库(请参阅config/gitlab.yml gitlab_shell -> repos_path
  • 运行以下命令

    bundle exec rake gitlab:import:repos RAILS_ENV=production
    

答案 2 :(得分:4)

对我来说,复制存储库的位置是 - / var / opt / gitlab / git-data / repositories

我在上面的dir中复制了我现有的裸存储库并运行了&gt; gitlab-rake gitlab:import:repos it working !!!

答案 3 :(得分:2)

我拥有它!这是我的ssh路径中缺少的目录。此问题已被跟踪here

抱歉,但错误消息并不那么明显。我希望这可以帮助像我这样的其他Gitlab初学者:)

相关问题