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

use*_*418 11 git import repository gitlab

导入我的裸git仓库到Gitlab被描述为在这里,因为它不被视为一个git仓库,而是创建了一个94K的大"空"回购(原来是2,8GB大):

$ 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!
Run Code Online (Sandbox Code Playgroud)

作为一种解决方法,我用我的裸仓库替换空项目文件夹(由导入试用版创建).然后我树从克隆远程克隆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.
Run Code Online (Sandbox Code Playgroud)

但是git用户应该拥有所需的所有权限. - 也许我有一些被忽视的东西?

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

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

Von*_*onC 10

Gitlab需要一个普通的存储库(非裸)吗?

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

你应该看到:

/home/git/repositories/user1/repo1.git
/home/git/repositories/user1/repo2.git
/home/git/repositories/greoup1/repo3.git
...
Run Code Online (Sandbox Code Playgroud)

确保您的test.git文件夹(以及其中的裸存储库文件)的权限与现有的裸存储库相同/home/git/repositories/.

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

但是:你需要确保GitLab(in ~git/repositories/arepo.git/hooks)创建的空裸仓库中的任何钩子都被复制到你的完整裸仓库中,替换空仓库(同一路径).
检查还有什么~git/repositories/arepo.git/info~git/repositories/arepo.git/config

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


至于提到的OP和GitLab记录" 故障排除指南 ",正确的SSH网址是:

git@git.myserver.com:repositories/mygroup/proj1.git
Run Code Online (Sandbox Code Playgroud)

:repositories提及.


导入裸存储库(如Sytse Sijbrandij 下面和之中所述raketasks/import.md)

  • 在git repos_path下复制你的裸存储库(参见参考资料config/gitlab.yml gitlab_shell -> repos_path)
  • 运行以下命令

    bundle exec rake gitlab:import:repos RAILS_ENV=production
    
    Run Code Online (Sandbox Code Playgroud)