I'm just getting started with SubGit and would like to use Gitlab in conjunction.
How would I go about using the Git repository provided by SubGit?
Follow these instructions in order to use SubGit for GitLab-managed repositories:
On the GitLab server, navigate to the repository directory:
For a manual install the path is /home/git/repositories/<group>/<project.git>
For Omnibus installs the path is /var/opt/gitlab/git-data/repositories/<group>/<project.git>
Configure SubGit mirror for created repository:
$ subgit configure --svn-url <url> <project.git>
Adjust configuration file: specify branches and tags mappings, etc.
$ edit <project.git>/subgit/config
Adjust authors mapping file:
$ edit <project.git>/subgit/authors.txt
Specify credentials to be used against SVN server:
$ edit <project.git>/subgit/passwd
Install SubGit into Git repository:
$ subgit install <project.git>
When initial import is done, go to GitLab repository page and see if imported changes are displayed there. In case repository remains empty, try restarting your GitLab instance as this should refresh internal caches.
Please note that according to documentation, GitLab 7.5+ reserves hooks directory for internal usage and one has to use custom_hooks directory for custom pre-receive and post-receive hooks instead.
subgit install
on the other hand generates hooks/pre-receive and hooks/post-receive executable scripts which may break GitLab setup for all repositories hosted by the server.
As result, if you're going to use GitLab 7.5+, I'd recommend to follow these slightly adjusted instructions:
1.— 6. The same steps as above;
Temporarily move hooks directory to hooks_backup:
$ mv <project.git>/hooks <project.git>/hooks_backup
Install SubGit into Git repository:
$ subgit install <project.git>
Move generated hooks directory to custom_hooks:
$ mv <project.git>/hooks <project.git>/custom_hooks
Finally restore GitLab hooks:
$ mv <project.git>/hooks_backup <project.git>/hooks
After that GitLab should trigger SubGit hooks on every push and so SubGit is able to synchronize pushed commits with SVN repository.
subgit configure
, subgit install
right on that just created empty Git repository. As soon as you have the import done, you can clone resulted repository anywhere and use it as usually. –
Subauricular © 2022 - 2024 — McMap. All rights reserved.