Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install Gitlab to run on a Subgit repository?

Tags:

git

gitlab

subgit

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?

like image 207
Jon Cage Avatar asked Jan 30 '15 13:01

Jon Cage


People also ask

Does GitLab work with SVN?

GitLab uses Git as its version control system. If you're using Subversion (SVN) as your version control system, you can migrate to using a Git repository in GitLab using svn2git . You can follow the steps on this page to migrate to Git if your SVN repository: Has a standard format (trunk, branches, and tags).

Does GitLab have repositories?

Because GitLab is a full stack solution for your DevOps needs, it also offers a third way to create a new repository: by creating a new project right from within GitLab. When you do this, a repository is automatically created for you.


1 Answers

Follow these instructions in order to use SubGit for GitLab-managed repositories:

  1. Create empty Git repository in GitLab;
  2. 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>

  3. Configure SubGit mirror for created repository:

    $ subgit configure --svn-url <url> <project.git>
    
  4. Adjust configuration file: specify branches and tags mappings, etc.

    $ edit <project.git>/subgit/config
    
  5. Adjust authors mapping file:

    $ edit <project.git>/subgit/authors.txt
    
  6. Specify credentials to be used against SVN server:

    $ edit <project.git>/subgit/passwd
    
  7. Install SubGit into Git repository:

    $ subgit install <project.git>
    
  8. 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;

  1. Temporarily move hooks directory to hooks_backup:

    $ mv <project.git>/hooks <project.git>/hooks_backup
    
  2. Install SubGit into Git repository:

    $ subgit install <project.git>
    
  3. Move generated hooks directory to custom_hooks:

    $ mv <project.git>/hooks <project.git>/custom_hooks
    
  4. 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.

like image 190
vadishev Avatar answered Oct 25 '22 00:10

vadishev