我按照 here 的描述将我的裸 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!
作为解决方法,我将空项目文件夹(由 import trial 创建)替换为我的裸存储库。然后我树从远程克隆 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 是否需要一个普通的仓库(non-bare)?或者我的问题是什么?
最佳答案
Does Gitlab need a normal repository (non-bare)?
不,所有由 gitlab 管理的 repos 都是 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/
下现有的裸仓库相同>.
如果导入不起作用,则应该“用我的裸仓库替换空项目文件夹(由导入试验创建)”。
但是:你需要确保 GitLab 创建的空裸仓库中的任何钩子(Hook)(在 ~git/repositories/arepo.git/hooks
中)被复制到你的完整裸仓库替换空的(相同的路径)。
还要检查 ~git/repositories/arepo.git/info
和 ~git/repositories/arepo.git/config
要进行调试,请首先尝试克隆 GitLab 在导入失败期间创建的空裸仓库。
然后将其替换为您自己的,仔细检查钩子(Hook)并重试。
作为mentioned通过OP并记录在 GitLab“Trouble Shooting Guide”中,正确的 ssh url 是:
git@git.myserver.com:repositories/mygroup/proj1.git
提到了 :repositories
。
导入裸仓库(如 Sytse Sijbrandij below 和 raketasks/import.md
中所述)
- 将你的裸仓库复制到 git repos_path 下(参见
config/gitlab.yml
gitlab_shell -> repos_path
) 运行下面的命令
bundle exec rake gitlab:import:repos RAILS_ENV=production
关于git - 如何将现有的裸 git 存储库导入 Gitlab?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18214363/